CFrame troubles with wave defense game

hi :slight_smile: today i decided to start making a tower defense game.
i am following this tutorial by gnomecode:https://www.youtube.com/watch?v=R3AREWh14iQ&list=PLtMUa6NlF10fEF1WOeDtuGcIn0RdUNL7c

rn, at the part where i set the cframe of a copied zombie from server storage, only 1/2 zombies spawns in, the other is in workspace but just doesnt show up ANYWHERE

heres my script:

local ServerStorage = game:GetService("ServerStorage")
local mob = {}

function mob.Move(mob, map)
	local humanoid = mob:WaitForChild("Humanoid")
	local waypoints = workspace.Waypoints

	for waypoint=1, #waypoints:GetChildren() do
		humanoid:MoveTo(waypoints[waypoint].Position)
		humanoid.MoveToFinished:Wait()
	end
	
end

function mob.Spawn(name, map)
	local mobExists = ServerStorage.Mobs:FindFirstChild(name)
	
	if mobExists  then
		local newMob = mobExists:Clone()
		newMob.HumanoidRootPart.CFrame = workspace.Map.SpawnBlock.CFrame
		newMob.Parent = workspace
		
		coroutine.wrap(mob.Move)(newMob, map)
	else
		warn("Mob could not be found!", name)
	end
end

return mob

and

local mob = require(script.Mob)
local map = workspace.Map

for i=1, 2 do
	mob.Spawn("Zombie", map)
	wait(3)
end

thanks for any help :slight_smile:

Try printing the waypoints table to see what’s happening; most likely, the times they don’t spawn are the times the pathfinding doesn’t find a path or calculate enough waypoints.

how would i print a waypoint table and where in the script?
im quite new to pathfinding ngl

Just use print().

Give this a read to learn more about pathfinding.

but like where in the script would i print

At the point where the waypoints table is.

print(#waypoints:GetChildren) can be placed in mob.Move.

dont that, all it does it repetively print 7(the number of waypoints
)