Ad
Log in to vote
0

Bad Argument #1 to 'remove'(table expected, got nil) Does anyone know how to fix this?[SOLVED]

Asked by 4 days ago
Edited 4 days ago

Dont worry about it, I figured out I put a period there instead of a comma XD

The script teleports players and as it is teleporting them it removes the spawn they landed on so people dont teleport on top of them or so no 2 people land on the same spawn. But I get an error?

Does anyone know how to fix it. Here the code :)

    local spawns = chosemap:WaitForChild("Spawns"):GetChildren()
    for _, player in pairs(game.Players:GetPlayers()) do 
        if player and #spawns > 0 then
            local uppertorso = player.Character:WaitForChild("UpperTorso")
            local allspawns = math.random(1, #spawns)
            local randomspawns = spawns[allspawns]
            if randomspawns and uppertorso then
                table.remove(spawns.allspawns)
                uppertorso.CFrame = CFrame.new(randomspawns.Position + Vector3.new(0, 3, 0))
            end
        end
    end

Thank you for your time

Hi.

Looks like you're using an ad blocker.

That's fine...

No, it really is.

Just, I mean, we put a lot of work into this site, you know?

It would be really really appreciated if you would turn off your ad blocker for our website...

We tried really hard to make our ads as unobtrusive as possible.

If you really hate ads, would you consider a $2 donation via Patreon?

Here's the link.

We love you. We hope you love us too.

.

..

...

Now back to your regularly scheduled Scripting Helpers....

...

..

.

Answer this question



Ad