Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with a PlayerAdded Function?

Hello, I wrote a script that when a player is added something happens but it doesn't work, here it is:

game.Players.PlayerAdded:Connect(function(player)
    print("yay")
end)

Does anyone know how to fix it?

9 comments

1

if it is in a local script the print wont work

1

Probably a FE problem, put it in a server script, not LocalScript, and place it in ServerScriptService

0

yh mate, print doesnt work in local scripts

0

level 2 scripter.

0

Don't be mean, he may be new...

0

level -infinity scripter.

0

Press X to doubt

0

PlayerAdded doesn't work for the client running the LocalScript.

0

And @stinkyest11 you were once a level 2 scripter, I was, everyone is, was, or will be one.

1 answer

✓ Accepted answer

Hello. Create a Script and put it in ServerScriptService. Then write your code. Here is an example:

game.Players.PlayerAdded:Connect(function(player)
	print("Welcome"..player.Name)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.