savebutton.MouseButton1Down:connect(function() print("1") player:WaitForDataReady() print("2") if player.DataReady == true then print("3") saveStage(player, player.leaderstats:WaitForChild("Stage").Value) print("4") frame.Visible = false end 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
local cashkey = "cash" game.Players.PlayerAdded:connect(function(player) local stats = Instance.new("IntValue", player) --Leaderboard stats.Name = "leaderstats" local cash = Instance.new("IntValue", stats) --Points/Cash cash.Name = "Cash" cash.Value = 0 player:WaitForDataReady() cash.Value = player:LoadNumber(cashkey) --Load end) game.Players.PlayerRemoving:connect(function(player) player:SaveNumber(cashkey, player.leaderstats.Cash.Value) --Save end)
That should work