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

Player Added doesn't work in a local script but Player Removing does?

This doesn't work:

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

But this does:

game.Players.PlayerRemoving:Connect(function(player)
	print(player.Name)
end)

Does anyone know why this is?

1 answer

✓ Accepted answer

Unlike Normal Scripts, Local Scripts only run once the player has joined. Assuming that you have only joined with a single player, it is not going to work, as the event is connected after the player has joined.

Your script will only run for players that join after you.

1 comment

1

If you're just trying to reference the current player from the local script, you can do so with game.Players.LocalPlayer

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