Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

3 comments

0

What line is erroring?

0

line 9

0

My best guess is that map is somehow nil

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.