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

How do I make a script continue if a specific player leaves the game?

Asked by 9 years ago

Okay, so I just need it to where it checks to see if the 'Owner' (string value with a players name) has left the game. This is what I tried:

if game.Players.PlayerRemoving and game.Players.PlayerRemoving.Name == script.Parent.Owner.Value then

1 answer

Log in to vote
1
Answered by 9 years ago

Yes you can check, you were close. You have to say:

game.Players.PlayerRemoving:connect(player) --The Player
    if player.Name==script.Parent.Owner.Value then
        --run code
    end
end)
0
W001: Unknown Global 'player'. Can you fix that? SchonATL 15 — 9y
0
According to the wiki that shouldn't have resulted in that error. Since player is in the connection line. It needs to be in a regular script not a local script. Make sure. XtremeSpy 80 — 9y
Ad

Answer this question