Need to know if it's possible to remove a string from a table by it's name, when they die.
Thanks
for i,checkdeath in pairs(game.Players:GetChildren()) do for i,playersplaying in pairs(playing) do checkdeath.Character:WaitForChild("Humanoid").Died:connect(function() print("user died") if string.lower(playersplaying) == string.lower(checkdeath.Name) then table.remove(playing, playersplaying) print("found and removed") print(playersplaying) else print("User not found in table") print(playersplaying) end end) end end
The correct usage for table.remove() is as follows-
table.remove(table,pos)
... meaning that you'd have to use the position of the value in the table to remove it, not the value itself.