So im trying to make a gamepass (developer products to get money via Robux) gui, and while testing it a few times, it worked, until i reached a certain value of around 400,000-500,000 bananas (thats my currency) it stopped working. Also, earlier when making my game, when i purchase something that has costs over 1 million bananas, it appears to decrease, but when i get some banana seeds (sellable item) and sell it, it resets back to before i bought the 1 million banana item (e.g from 1.3 million then i purchase it, then it becomes 300,000, but when the value gets modified (example: via selling seeds) it changes back to before it got bought (1.3 million)) and also im working on a Admin GUI and i wanna make a gui to give money, obviously i knew it wasn't going to work in the first place.
Leaderstats script:
Script name: leaderstats
Script type: server side
Script code:
game.Players.PlayerAdded:Connect(function()
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local coins = Instance.new("IntValue", leaderstats)
coins.Name = "Bananas"
local resets = Instance.new("IntValue", leaderstats)
resets.Name = "Rebirths"
local bananaseeds = Instance.new("IntValue", leaderstats)
bananaseeds.Name = "BananaSeeds"
end)
My gamepass handler script (ServerScriptService):
Type: server side
Name: DevPrdctHndlr
Code:
local mps = game:GetService("MarketplaceService")
mps.ProcessReceipt = function(reciptInfo)
if reciptInfo.ProductId = 1146099164 then
--[Donate to me!]
local player = game.Players:GetPlayerByUserId(reciptInfo.PlayerId)
player.leaderstats.BananaSeeds.Value =
player.leaderstats.BananaSeeds.Value + 10000
player.leaderstats.Bananas.Value =
player.leaderstats.Bananas.Value + 50000
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
Buy SmoothPlasticWand script (its a shop gui textbutton):
Type: localscript
Name: BuyScript
Location: game.StarterGui.ShopGui.ShopFrame.SmoothPlasticWand.BuyScript
Code:
local Button = script.Parent
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local currency =
game.Players.LocalPlayer.leaderstats:WaitForChild("Bananas")
Button.MouseButton1Up:Connect(function()
if currency.Value >= 1000000 then
ReplicatedStorage.ReplicatedWands.SmoothPlasticWand:Clone().Parent = game.Players.LocalPlayer:WaitForChild("Backpack")
game.Workspace.Musounds.Buy:Play
currency.Value = currency.Value - 1000000
end)
Im sorry if this question is a duplicate, im still a noob at StackOverflow and im sorry if this question isn't detailed enough, i will provide additional details if you want.
question from:
https://stackoverflow.com/questions/65938615/how-can-i-make-it-so-a-change-of-a-intvalue-is-permanent 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…