local players = game.Players:GetPlayers()
table.add(players,game.Players:GetPlayers())
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
char.Humanoid.Died:Connect(function(died)
local find = table.find(players, player)
if find then
table.remove(players, find)
print (players)
end
end)
end)
end)
Tell me if you need any other scripts and ignore the extra ends lol.
Pretty sure this would always error since add isn’t a valid method for the table library and I think you meant insert. But eitherways, this is unneeded since it would put the players twice, the first line of the script already does what is needed, get all the players
And your other issue, it’s only going to remove them if they had joined by the time the event was made. It’s better to loop through all the players, get their character , and set up the Died event on theri humanoid
for _,player in pairs(game.Players:GetPlayers()) do
local humanoid = player.Character.Humanoid
humanoid.Died:Connect(function()
end)
end
To add a bit more clarity as to what the things are doing, i became _ to show you never use it, v to player because you’re getting a player each iteration. And hum to humanoid to show a bit more clearly that there’s a humanoid in that variable
But its’ all personal preference, in general, yea that’s what I had in mind