|
| 08 Jul 2011 09:38 AM |
I have been working on this Simple data persistance script for players. All you would have to do is put it in the workspace and it would save your scores. However its not working. Could anyone help? ------------------------------------------------------------------------------------------ function onPlayerEntered(player) wait()-- Give the game a moment to find the player instead of shooting instantly player:WaitForDataReady() -- Gotta have this if player.DataReady then if player:findFirstChild("leaderstats") then local score = player.leaderstats:GetChildren() -- Were going to find some scores. for i = 1,#score do local ScoreLoaded = player:LoadNumber(score[i].Value) -- This looks for the score wait() -- Wait for the score to load. if ScoreLoaded ~= 0 then score[i].Value = ScoreLoaded end end end end end
function onPlayerLeaving(player) -- We gotta fire this before the player leaves. if player:findFirstChild("leaderstats") then local score = player.leaderstats:GetChildren() -- Targeting the scores before the player is gone for i = 1,#score do player.leaderstats:findFirstChild(score[i]):SaveNumber(score[i].Name,score[i].Value) -- Saving the score. end end end
game.Players.ChildAdded:connect(onPlayerEnterd) game.Players.PlayerRemoving:connect(onPlayerLeaving)
------------------------------------------------------------------------------------------ Does anyong know the problem? And yes the output isnt saying anything. |
|
|
| Report Abuse |
|
|
myrco919
|
  |
| Joined: 12 Jun 2009 |
| Total Posts: 13241 |
|
| |
|
|
| 08 Jul 2011 09:52 AM |
player:WaitForDataReady() -- Gotta have this if player.DataReady then
Whats the point of the second line. The first one will wait to do the rest of the script until the Data is ready
~ Mitch ~ |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|