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

Nil value Argument 1?

Asked by 10 years ago
    for i = 0, #teleplayers do
        randomspawn = math.random(1, #spawn_locations)
        game.Players:FindFirstChild(teleplayers[i]).Character.Torso.CFrame = CFrame.new(spawn_locations[randomspawn])
                wait()
                table.remove(teleplayers, i)
                wait()
                end

For an unknown reason I get the error "argument 1 nil value", so it's like not working out that the teleplayers is a value, which is starting to grind my teeth.

1 answer

Log in to vote
-1
Answered by 10 years ago

CFrame cannot be in a table. Use parts as your spawns. Your argument 1 isn't the teleplayers but the CFrame.new(spawn_locations[randomspawn])

Maybe it should be something like...

game.Players:findFirstChild(teleplayers[i]).Character.Torso.CFrame = spawn_locations[randomspawn].CFrame

0
That shouldn't be the problem, because I'm trying to change the CFrame, it would be CFrame.new(position) AstralKick 25 — 10y
0
Hey I'm only answering with what was provided given. soaprocks2 75 — 10y
Ad

Answer this question