After you save something you'll have to load it too.
Make a simple Script and throw it at the Workspace.
Start by making the Gold value and the leaderstats. Every Time the player enters the game the Gold Value will be the one of the Key we will save.
03 | game.Players.PlayerAdded:connect( function (player) |
04 | if player:WaitForDataReady() then |
06 | local ls = Instance.new( "IntValue" ) |
07 | ls.Name = "leaderstats" |
11 | local Golded = Instance.new( "IntValue" ) |
14 | Golded.Value = player:LoadNumber(GoldKey) |
Now for the save button create a ScreenGui and put it inside the StarterGui folder. Insert the a button into it and a normal script with that code :
4 | if player:FindFirstChild( "leaderstats" ) then |
5 | player:SaveNumber(GoldKey, player.leaderstats.Gold.Value) |
9 | script.Parent.MouseButton 1 Down:connect(Saved) |