So I created a table and it adds players names into it, but I want it to remove the player names when the player leaves, so I tried using table.remove:
activePlayers ={}
-- adds players to table if they join server
game.Players.PlayerRemoving:Connect(function(player)
for i, v in pairs(activePlayers)do
if v == player.Name then
print("user removed")
table.remove(activePlayers, i)
else
end
end
end)
I am not sure why this is not working because I tried to remove the value for that player, but I'm not sure how to get rid of the player from my table.

1 comment
Would I have to do on line 7: if tostring(v) == player.Name then