Like when a player is added or respawned?
The events .PlayerAdded and .PlayerRemoving are used like this:
players = {} function RemoveFromTable(thetable, toberemoved) -- That's a function I made due to no such function existing. if thetable == nil then error("ERROR | FIRST ARGUMENT/TABLE IS NIL | FUNCTION: RemoveFromTable") end if thetable == nil then error("ERROR | SECOND ARGUMENT/OBJECT IS NIL | FUNCTION: RemoveFromTable") end local istoberemovedintable = false for _, yesorno in pairs(thetable) do if yesorno == toberemoved then istoberemovedintable = true end end if istoberemovedintable == false then error("ERROR | SECOND ARGUMENT/OBJECT IS NOT IN TABLE | FUNCTION: RemoveFromTable") end for i = 1/table.getn(thetable), table.getn(thetable) do if thetable[i*table.getn(thetable)] == toberemoved then table.remove(thetable, i*table.getn(thetable)) end end end game.Players.PlayerAdded:connect(function(plr) table.insert(players, plr) end) game.Players.PlayerAdded:connect(function(plr) RemoveFromTable(players, plr) end)
But an easier way would be to just use the :GetPlayers() function. Like this:
players = game.Players:GetPlayers()