Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can localscript... ?

Asked by 10 years ago

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

Log in to vote
2
Answered by 10 years ago

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)
0
To clarify: This won't work in a LocalScript (and the events don't even fire for other players, for some reason) BlueTaslem 18071 — 10y
Ad

Answer this question