Help with Pathfinding

This is my first time using the PathFindingService so bear with me :sweat_smile:

For some reason my dummy model will not move. Im unsure why and i was sure to remove any welds. Im just testing out pathfinding for a project of mine and im not sure why it isnt working. Heres the code

repeat task.wait(1) until game:IsLoaded() task.wait(1)

local parent = script.Parent
local pathFinding = game:GetService("PathfindingService")
local root = parent:FindFirstChild("HumanoidRootPart")

local hum = script.Parent.Humanoid
local destination = Vector3.new(30, 0, 0)
local parms = {
	radius = 2,
	height = 5,
	canJump = false
}

local path = pathFinding:CreatePath(parms)

path:ComputeAsync(root.Position, destination)
local waypoints = path:GetWaypoints()

for i, v in pairs(waypoints) do
	hum:MoveTo(v.Position)
	if v.Action == Enum.PathWaypointAction.Jump then
		hum.Jump = true
	end
	hum.MoveToFinished:Wait()
end


Help would be appreciated, thank you for your time :smiley:

Did you unanchor the HumanoidRootPart?

1 Like

Yes, the rootpart is unanchored

I found the solution, thank you to all who helped!

I basically just had to remove the task.wait part.

local parent = script.Parent
local pathFinding = game:GetService("PathfindingService")
local root = parent:FindFirstChild("HumanoidRootPart")

local hum = script.Parent.Humanoid
local destination = game.Workspace.Part.Position
local parms = {
	radius = 2,
	height = 5,
	canJump = false
}

local path = pathFinding:CreatePath(parms)

path:ComputeAsync(root.Position, destination)
local waypoints = path:GetWaypoints()

for i, v in pairs(waypoints) do
	hum:MoveTo(v.Position)
	if v.Action == Enum.PathWaypointAction.Jump then
		hum.Jump = true
	end
	hum.MoveToFinished:Wait()
end

Lol, we all do that kind of stuff.