Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the wallet value on my in-game GUI the same as the saved wallet value?

Asked by 3 years ago

Right now I am testing my money saving system. When I click the part with the ClickDetector, the part gives the player a set amount of money to the wallet and the wallet value changes in the GUI but it does not save the value. When I join back to see if the Wallet has been saved it is always reset. How do I make the saved wallet value the same as the wallet value on the in-game GUI?

local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
local Wallet = stats:WaitForChild("Wallet")

game.Workspace.ClickBox.ClickDetector.MouseClick:Connect(function()
    stats.Wallet.Value = stats.Wallet.Value + 10
end)

script.Parent.Text = "$"..stats.Wallet.Value

while wait() do
    script.Parent.Text = "$"..stats.Wallet.Value
end

Answer this question