while wait() do
if zombieHum.Health <= 0 then
zombieHum.Parent:ClearAllChildren()
end
local humRootPart = FindTarget()
if humRootPart then
local zombiePath = PFS:CreatePath()
zombiePath:ComputeAsync(zombieTorso.Position, humRootPart.Position)
local waypoints = zombiePath:GetWaypoints()
for i, v in pairs(waypoints) do
if waypoints.Action == Enum.PathWaypointAction.Jump then
zombieHum:ChangeState(Enum.HumanoidStateType.Jumping)
end
zombieHum:MoveTo(v.Position)
zombieHum.MoveToFinished:Wait()
end
zombieHum:MoveTo(humRootPart.Position)
else
wait(1)
zombieHum:MoveTo(zombieTorso.Position + Vector3.new(math.random(-50,50), 0, math.random(-50,50)))
end
end
while wait() do
local humRootPart = FindTarget()
if humRootPart then
local zombiePath = PFS:CreatePath()
zombiePath:ComputeAsync(zombieTorso.Position, humRootPart.Position)
local waypoints = zombiePath:GetWaypoints()
for i, v in pairs(waypoints) do
if waypoints.Action == Enum.PathWaypointAction.Jump then
zombieHum:ChangeState(Enum.HumanoidStateType.Jumping)
end
zombieHum:MoveTo(v.Position)
zombieHum.MoveToFinished:Wait()
end
-- removed line that was here
else
wait(1)
zombieHum:MoveTo(zombieTorso.Position + Vector3.new(math.random(-50,50), 0, math.random(-50,50)))
end
end
That line wasn’t the problem, the lines I quoted were.
You are looping through all the waypoints and calling MoveToFinished:Wait() for each one. The code doesn’t move to the next iteration of the while loop until all that work is done.