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

Why does this error "table expected, got string"?

Asked by 9 years ago

I've been making a trello syncing ban list, and it work's so far except for removing the ban's to re-add them so it doesn't spam the same ban in the table it error's bad argument #1 to 'remove' (table expected, got string). Can someone tell me what I'm doing wrong here?

local BanList = {}

game.Players.PlayerAdded:connect(function(Player)
    table.insert(BanList,Player.Name)
end)()

while wait(5) do
    if #BanList >= 1 then
        for i = 1,#BanList do
            table.remove(BanList[1])
        end
    end
end

Answer this question