Humanoid:MoveTo not working if a loop comes after

  1. What do you want to achieve? Keep it simple and clear!
    Humanoid:MoveTo() and trying to make it smoother movement than using MoveToFinished()
  2. What is the issue? Include screenshots / videos if possible!
    The MoveTo() doesn’t happen if a loop comes right after
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Placing it only so the loop comes at Waypont[3], the humanoid moves to waypoint 1 and 2, but not 3.
    MoveTo() Works when there is no loop and only using MoveToFinished()
for i,v in pairs(waypoints) do
                if v.Action ==Enum.PathWaypointAction.Jump then
                    humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
                end    
                humanoid:MoveTo(v.Position)
                repeat  
                    print(humanoid.Parent.HumanoidRootPart.Position)
                    wait(.1)
                until (humanoid.Parent.HumanoidRootPart.Position- 
                destinationObject.Position).Magnitude<1
                --humanoid.MoveToFinished:Wait()
end

No part of the character is anchored

you should be putting the move to first and then the action and then this

humanoid.MoveToFinished:wait()

I dont think she wants to use MoveToFinished. Make sure to read before post.

I’ve tested a lot of variatons of Pathfinding and find it is never really smooth. I’ve just tested a few and the following is one of my better ones:

function findTarget()
	local dist = 200
	local target = nil 
	for i,v in pairs(workspace:GetChildren()) do
		local player = v:FindFirstChild("Humanoid")
		local head = v:FindFirstChild("Head")
		if (head.Position - rootPart.position).magnitude < dist and player.Health > 0 then
			dist = (head.Position - rootPart.position).magnitude
				target = head
		end
	end
	return target
end

-- MAIN NPC PATHING LOOP
while true do 
	wait(5)
	
-- FIND PLAYER TARGET	
	local head = findTarget()

-- TARGET FOUND
	if head then 
		local ray = Ray.new(rootPart.Position, (head.Position - rootPart.Position).Unit * 200)
		local hit,position = workspace:FindPartOnRayWithIgnoreList(ray,{robot})
		if hit then
			path = PathfindingService:FindPathAsync(rootPart.Position, head.Position)
			waypoints = path:GetWaywaypoints()
		
			if path.Status == Enum.PathStatus.Success then -- Start looping thru Waypoints
				for i,v in pairs(waypoints) do
					humanoid:MoveTo(v.Position)
					if (waypoints[#waypoints].Position - head.Position).magnitude < 2 then --Stop if really close to last waypoint and move on to next to stop thew jerkiness it can display
						break
					end
				end
				
				if (waypoints[#waypoints].Position - head.Position).magnitude < 3 then -- are we at the final waypoint?
					print("Yay, almost at last waypoint, so do stuff")
					bombChecker()
					plant(Tool.Handle.Position)
				end
			end
		end
	end
end

The above is the smoothest I have got the movement to be so far. I haven’t played with it for quite a few months as my NPCs have been designed to navigate mazes by themselves and attack players. I stopped developing when i found they kept getting stuck on the corners of walls. When the interest returns, they will get the addition of raycasting just to nudge them as they move.

Thank you a lot, will definitely try this