generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: PlayerAdded not calling?

Previous Thread :: Next Thread 
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
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
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
13 Feb 2014 06:10 PM
It's in a Script inside ServerScriptService
Report Abuse
TheLagScript is not online. TheLagScript
Joined: 13 Apr 2012
Total Posts: 2004
13 Feb 2014 06:17 PM
I believe its:
game.workspace.ChildAdded:connect(function)

~14 Years Old: C++/Lua/PHP~
Report Abuse
Christbru01 is not online. Christbru01
Joined: 03 Apr 2010
Total Posts: 649
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image