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

If a player leaves a game are they automatically removed from any tables they are a part of?

Asked by 10 years ago

I am making a racing game and I have a table, full of players currently in the race. If one of those players leaves the game will they automatically be removed from said table?

1 answer

Log in to vote
-2
Answered by 10 years ago

You could do this:

game.Players.PlayerRemoving:connect(function(oldplr)
    table.remove(TABLENAME, oldplr)
end)

And I don't think they are automatically removed

3
They aren't. Assume nothing in programming is done for you, because most of the time it isn't. And your removeal code will only work if the table is a Dictionary. If it's just a list, you'll have to loop through it to find the player. adark 5487 — 10y
Ad

Answer this question