Can't Pathfind a Blank R15 Rig?

Hello there!

Today I was attempting to try and learn pathfinding.

However, my code doesn’t seem to be working on a blank R15 rig I have.

Here’s is my code:

local Npc = script.Parent
local Humanoid = Npc.Humanoid

local PathfindingService = game:GetService("PathfindingService")

local function getPath(destination)
	local path = PathfindingService:CreatePath()

	path:ComputeAsync(Npc.HumanoidRootPart.Position, destination.Position)
	
	return path
end

local function walkTo(destination)
	local path = getPath(destination)
	
	for index,waypoint in pairs(path:GetWaypoints()) do
		Humanoid:MoveTo(waypoint.Position)
		Humanoid.MoveToFinished:Wait()
	end
end

while true do
	walkTo(workspace.destination)
	walkTo(workspace.destinatino2)
	print("Walking to destination")
end

I’ve checked multiple sites/videos to see what I’ve done wrong. However, nothing seems to be working. If someone could help me with this, that would be great.

Thank you!

try and use while wait() do on it

Edit: This script actually doesn’t work for R15, only R6. There was nothing wrong with the script in general.

Thank you!

This is inaccurate.

If you’re using R15 AND this script, make sure the HumanoidRootPart is unanchored.