Character not moving to waypoint

  1. What do you want to achieve? I want to make a dummy climb up a tower

  2. What is the issue? The first waypoint is created, but the dummy is not moving

  3. What solutions have you tried so far? I could not find any solutions as I found this as a resource

The dummy is anchored, but still not moving.

-- local PathfindingService = game:GetService("PathfindingService")

local path = PathfindingService:CreatePath()


		local humanoid = script.Parent
		
		path:ComputeAsync(script.Parent.Parent.HumanoidRootPart.Position, workspace.Destination.Position)
		-- Get the path waypoints
		local waypoints = path:GetWaypoints()

		-- Loop through waypoints
		for _, waypoint in pairs(waypoints) do
			
			-- Move zombie to the next waypoint
	humanoid.Parent:MoveTo(waypoint.Position)
			-- Wait until zombie has reached the waypoint before continuing
			humanoid.MoveToFinished:Wait()
			
		end
	

All help is appreciated :smiley:

1 Like

Basically, I am trying to make a dummy climb a tower, I tried moving the destination a couple of studs away but still didn’t budge. I made the script print the waypoint’s position, and the waypoints are correct.

Try doing humanoid:MoveTo(waypoint.Position) instead of humanoid.Parent:MoveTo(waypoint.Position)

1 Like

Still not working… the character didnt move at all. No errors

Where is the script this code is in located?

image

Inside the humanoid

Why is the PathfindingService line commented out?
Also, could you please replace

        for _, waypoint in pairs(waypoints) do
			
			-- Move zombie to the next waypoint
	        humanoid.Parent:MoveTo(waypoint.Position)
			-- Wait until zombie has reached the waypoint before continuing
			humanoid.MoveToFinished:Wait()
			
		end

with

-- Loop through waypoints
for _, waypoint in pairs(waypoints) do
	local part = Instance.new("Part")
	part.Shape = "Ball"
	part.Material = "Neon"
	part.Size = Vector3.new(0.6, 0.6, 0.6)
	part.Position = waypoint.Position
	part.Anchored = true
	part.CanCollide = false
	part.Parent = game.Workspace
 
	-- Move zombie to the next waypoint
	humanoid:MoveTo(waypoint.Position)
	-- Wait until zombie has reached the waypoint before continuing
	humanoid.MoveToFinished:Wait()
end

What this does is add a small neon part for each waypoint, that way we can tell if the way point is even created (code by Roblox). Also, tell me if the waypoints are created. If they aren’t, it means it’s an issue with the loop, probably.

1 Like

How is the neon balls going to help?? The waypoints work, I tested that out already. Also I accidently commented out the pathfinding while making this page.

Oh, I see. Didn’t know that.
I believe you have to unanchor the NPC. Or, at least HumanoidRootPart, I think. Also, make sure the NPC’s speed is above 0.

2 Likes

Thanks! The walkspeed was set to 0, not quite sure why…

1 Like