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

Can localscript... ?

Can you detect with a even if a player has left or entered a game within a localscript that's placed in all player guis so they all contain it?

1 answer

You can use .PlayerAdded or .PlayerRemoved to accomplish this. Here is a bit of code that can help get you started. Use this as a script in Workspace.

game.Players.PlayerAdded:connect(function(plr)
--effect the 'plr' which is the player that just joined
end)

game.Players.PlayerRemoved:connect(function(plr)
--effect the 'plr' which is the player that just left
end)

1 comment

0

To clarify: This won't work in a LocalScript (and the events don't even fire for other players, for some reason)

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