01 | savebutton.MouseButton 1 Down:connect( function () |
02 | print ( "1" ) |
03 | player:WaitForDataReady() |
04 | print ( "2" ) |
05 | if player.DataReady = = true then |
06 | print ( "3" ) |
07 | saveStage(player, player.leaderstats:WaitForChild( "Stage" ).Value) |
08 | print ( "4" ) |
09 | frame.Visible = false |
10 | end |
11 | end ) |
This script only prints 1, and I have tried it in a Server and a Local Script, with no difference. Why doesn't it work?
I don't know why you need a button -.- This does it automatically
I didn't really understand what you we're asking for so this is my best guess
01 | local cashkey = "cash" |
02 | game.Players.PlayerAdded:connect( function (player) |
03 | local stats = Instance.new( "IntValue" , player) --Leaderboard |
04 | stats.Name = "leaderstats" |
05 | local cash = Instance.new( "IntValue" , stats) --Points/Cash |
06 | cash.Name = "Cash" |
07 | cash.Value = 0 |
08 | player:WaitForDataReady() |
09 | cash.Value = player:LoadNumber(cashkey) --Load |
10 | end ) |
11 | game.Players.PlayerRemoving:connect( function (player) |
12 | player:SaveNumber(cashkey, player.leaderstats.Cash.Value) --Save |
13 | end ) |
That should work