kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
|
| 03 Mar 2012 09:11 AM |
Yeah so one of my first problems is inserting the value.
I expected it to work becuase I do leaderboards all the time.
But for some reason the IntValue is not being inserted into the new player.
Another problem. Since I can't tell if the Saving will work, becuase the IntValue wasn't inserted so can you check those two.
I'm just a begginer at this.
Here's the script:
game.Players.PlayerAdded:connect(function(newplayer) local new_score = player:LoadNumber("Job") local new_stat = Instance.new("IntValue", newplayer) new_stat.Name = "Job" new_stat.Value = 1 print("Stat given = 1") wait(2) player.Job.Value = new_score player:WaitForDataReady() print(new_score) end)
game.Players.CharacterRemoving:connect(function(player) player:WaitForDataReady() player:SaveNumber("Job", player.Job.Value) end)
So yeah.. is there any problems.
{Young Grasshopper} |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 03 Mar 2012 09:14 AM |
You need to use WaitForDataReady() also for Loading!
So.
game.Players.PlayerAdded:connect(function(newplayer) player:WaitForDataReady() local new_score = player:LoadNumber("Job") local new_stat = Instance.new("IntValue", newplayer) new_stat.Name = "Job" new_stat.Value = 1 print("Stat given = 1") wait(2) player.Job.Value = new_score print(new_score) end)
game.Players.CharacterRemoving:connect(function(player) player:WaitForDataReady() player:SaveNumber("Job", player.Job.Value) end)
Also. Test this on a SERVER. Not on your PC, but online. Because OFFLINE on your PC the DataReady is NEVER true, so it will stall at WaitForDataReady()! |
|
|
| Report Abuse |
|
|
kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
|
| 03 Mar 2012 09:17 AM |
| I'm guessing Play_Solo is not on a Server. :( Kk. I'll add the :WaitForDataReady() on the load. No other problems. Kk. I'll try it. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 03 Mar 2012 09:19 AM |
Remember, ON Roblox itself. Its kinda frustrating because you gotta upload it, but if you go to solo, or server, and then go to your Player in game.Players you will NEVER see that the DataReady box is true.
Just a random fact, you kno what :WaitForDataReady() is?
Its actually, repeat wait() until (place where the player is).DataReady == true
Thats it :P
|
|
|
| Report Abuse |
|
|
kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
|
| 03 Mar 2012 09:41 AM |
| I'm checking but the IntValue isn't being inserted into the Player. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 03 Mar 2012 09:47 AM |
Yes of course. You are playing on play solo now right? Or on your pc at least?
It stalls at the WaitForDataReady, because on your PC it will NEVER be ready and thus ENDLESSLY wait. Remove that one and THEN check if it works! Also remove the Load() then, i dont think it will work.
Just do like to CHECK if you value is inserted put AFTER the lines of the int value like;
game.Workspace.Message.Text = newplayer.Job.Value
If message is 1 then it works! (This is PRINTING on server!)
|
|
|
| Report Abuse |
|
|
kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
| |
|
kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
|
| 03 Mar 2012 10:11 AM |
Didn't Work.
game.Players.PlayerAdded:connect(function(newplayer) local new_score = player:LoadNumber("Job") local NewMessage = Instance.new("Message", game.Workspace) new_stat.Name = "Job" new_stat.Value = 1 NewMessage.Text = new_stat.Value print("Stat given = 1") player:WaitForDataReady() wait(2) player.Job.Value = new_score NewMessage.Text = new_score print(new_score) end)
game.Players.CharacterRemoving:connect(function(player) player:WaitForDataReady() player:SaveNumber("Job", player.Job.Value + 1) end) |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 03 Mar 2012 10:24 AM |
game.Players.PlayerAdded:connect(function(newplayer) player:WaitForDataReady() local new_score = player:LoadNumber("Job") local NewMessage = Instance.new("Message", game.Workspace) new_stat.Name = "Job" new_stat.Value = 1 NewMessage.Text = new_stat.Value print("Stat given = 1") player:WaitForDataReady() wait(2) player.Job.Value = new_score NewMessage.Text = new_score print(new_score) end)
game.Players.CharacterRemoving:connect(function(player) player:WaitForDataReady() player:SaveNumber("Job", player.Job.Value + 1) end)
Try again with this. |
|
|
| Report Abuse |
|
|