|
| 13 Feb 2014 06:09 PM |
I can't figure it out for the life of me.. I've tried tweaking it soo many times now but nothing.. you can see this isn't working in Cross-Server chat.. it's supposed to put a hint in your PlayerGui to let you know when it is doing stuff.. but it doesn't put the hint nor does it set the data like it should.. no errors.. it just doesn't run..
CODE:
function playerAdd(newPlayer) repeat wait() until newPlayer:FindFirstChild("PlayerGui") local hint = Instance.new("Hint",newPlayer.PlayerGui) hint.Text = "Now waiting for data ready." newPlayer:WaitForDataReady() hint.Text = "Done waiting for data ready." if not newPlayer:LoadNumber("CBMoneySystem") then hint.Text = "Trying to set the playerdata to 0" newPlayer:SaveNumber("CBMoneySystem",0) playerData[newPlayer.Name] = '0' hint.Text = "Set the playerdata to 0" else hint.Text = "Trying to set the playerdata to the previously saved amount" playerData[newPlayer.Name] = tostring(newPlayer:LoadNumber("CBMoneySystem")) hint.Text = "Set the playerdata to the previously saved amount" end end game.Players.PlayerAdded:connect(playerAdd)
function playerLeave(oldPlayer) oldPlayer:SaveNumber("CBMoneySystem",playerData[newPlayer.Name]) end game.Players.PlayerRemoving:connect(playerLeave)
for _,plr in pairs(game.Players:GetPlayers()) do playerAdd(plr) end |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2014 06:10 PM |
| It's in a Script inside ServerScriptService |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2014 06:17 PM |
I believe its: game.workspace.ChildAdded:connect(function)
~14 Years Old: C++/Lua/PHP~ |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2014 06:21 PM |
| That's nowhere near right.. that's calling for anything added to workspace, which at most would be a character of the player, I'm trying to get when the player joins.. which with my current code should work.. but it doesn't.. so I'm trying to see if any advanced Lua users know about this and know why it happens.. |
|
|
| Report Abuse |
|
|