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

Help with :WaitForDataReady()?

Asked by 9 years ago
01savebutton.MouseButton1Down: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
11end)

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?

0
Is this in Server mode or studio mode? ChemicalHex 979 — 9y
0
I've tried everything, studio, server and online NinjoOnline 1146 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

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

01local cashkey = "cash"
02game.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
08player:WaitForDataReady()
09cash.Value = player:LoadNumber(cashkey) --Load
10end)
11game.Players.PlayerRemoving:connect(function(player)
12    player:SaveNumber(cashkey, player.leaderstats.Cash.Value) --Save
13end)

That should work

Ad

Answer this question