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

How to fix 'attempt to index nil with start'?

Asked by 1 year ago

My output is displaying 'attempt to index nil with start' even though start is there! I don't know what to do!

function mob.Spawn(name, quantity, map)
local mobExists = Mobs:FindFirstChild(name)


    if mobExists then
        for i=1, quantity do
            task.wait(0.5)
            local newMob = mobExists:Clone()
            newMob.HumanoidRootPart.CFrame = map:WaitForChild("Start").CFrame
            newMob.Parent = map.Mob
            newMob.HumanoidRootPart:SetNetworkOwner(nil)


            coroutine.wrap(mob.Move)(newMob, map)


            for i, object in ipairs(newMob:GetDescendants()) do
                if object:IsA("BasePart") then
                    PhysicsService:SetPartCollisionGroup(object, "Mob")
                end
            end
        end


    else
        warn(name .. " isn't there!")

    end
end
0
What line is erroring? virushunter9 943 — 1y
0
line 9 hex2decimal 2 — 1y
0
My best guess is that map is somehow nil virushunter9 943 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago

Map was somehow nil and I moved all the important folders out and it worked.

Ad

Answer this question