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

Why isn't this script working when I have made sure to triple check?

Asked by 5 years ago

I got this in output..

ServerScriptService.MainScript:105: bad argument #1 to 'remove' (table expected, got nil)

So this is line 105:

table.remove(plrs.x)

and these are the lines AROUND line 105

-- They are still alive
                    print(player.Name.." is still in the game!")
                else
                    --They are dead
                    table.remove(plrs.x)
                    print(player.Name.." has been killed!")
                end
            end

is there a reason for the output saying what it says?

1 answer

Log in to vote
0
Answered by
LuaDLL 253 Moderation Voter
5 years ago
-- They are still alive
                    print(player.Name.." is still in the game!")
                else
                    --They are dead
                    for i,v in pairs(plrs) do
                        if v == x then
                            table.remove(plrs,i) -- Has to be a number for the index to use table.remove
                        end
                    end
                    print(player.Name.." has been killed!")
                end
            end

Ad

Answer this question