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 » Scripters
Home Search
 

Re: PlayerAdded event does not fire

Previous Thread :: Next Thread 
imaginaryUberlyuber is not online. imaginaryUberlyuber
Joined: 15 Jul 2012
Total Posts: 208
18 Feb 2016 02:19 AM
So for some reason doing

game.Players.PlayerAdded:connect(function()
--code
end)

Does absolutely nothing. So why does the PlayerAdded event never fire?
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
18 Feb 2016 02:19 AM
Where is your script located?



Report Abuse
imaginaryUberlyuber is not online. imaginaryUberlyuber
Joined: 15 Jul 2012
Total Posts: 208
18 Feb 2016 02:21 AM
Originally I tried it as a localscript in ScreenGui (as part of a frame), then tried it as a script in ServerScriptService. Same result.
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
18 Feb 2016 02:22 AM
So you tried a local script in ServerScriptService?

Local scripts only work client sided. Use a normal script.
I advise you don't use playeradded via client side as it will never record the client itself being added.



Report Abuse
imaginaryUberlyuber is not online. imaginaryUberlyuber
Joined: 15 Jul 2012
Total Posts: 208
18 Feb 2016 02:23 AM
I used a server script in ServerScriptService (you can't use LocalScripts in SSS)
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
18 Feb 2016 02:25 AM
Delete your current script and put this:
A normal script in ServerScriptService:

game.Players.PlayerAdded:connect(function(player)
print(player.Name)
end)

This will work ;)



Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
18 Feb 2016 02:25 AM
The only thing I can think of is that Disabled = true
Report Abuse
imaginaryUberlyuber is not online. imaginaryUberlyuber
Joined: 15 Jul 2012
Total Posts: 208
18 Feb 2016 02:27 AM
@ninetailfox Nope

Here is what my code does:

game.Players.PlayerAdded:connect(function()
local userData = Instance.new("NumberValue")
userData.Parent = game.ReplicatedStorage.userData
userData.Name = tostring(game.Players.LocalPlayer)

if game.Players.LocalPlayer.TeamColor.Name == "Really red" then
userData.Value = 0
elseif game.Players.LocalPlayer.TeamColor.Name == "Really blue" or game.Players.LocalPlayer.TeamColor.Name == "Lapis" then
userData.Value = 1
end
end)
Report Abuse
ninetailfox73 is not online. ninetailfox73
Joined: 11 Mar 2008
Total Posts: 1954
18 Feb 2016 02:29 AM
firstly you can't use game.Players.LocalPlayer on a server side script, do what Advanced said, and use "player.TeamColor"
Report Abuse
imaginaryUberlyuber is not online. imaginaryUberlyuber
Joined: 15 Jul 2012
Total Posts: 208
18 Feb 2016 02:29 AM
Okay nevermind it now works. After a whole lot of waiting.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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