Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is it possible to remove a string from a table?

Asked by
TopDev 0
10 years ago

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

Log in to vote
0
Answered by 10 years ago

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.

Ad

Answer this question