Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it possible to remove a string from a table?

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

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.