What's wrong with my path finding script?

I’m just trying to get a Humanoid to walk to a position. But my script doesn’t seem too be working.


while true do
	wait(1)
local maxDistance = 5000 -- Maximum distance for the path

local dummy = script.Parent

local PathService = game:GetService("PathfindingService")

	local path = PathService:ComputeRawPathAsync(dummy.HumanoidRootPart.Position, game.Workspace.Finish.Position, maxDistance)
if path.Status == Enum.PathStatus.Success then
	local points = path:GetPointCoordinates()
	for node = 1, #points do
		dummy.Humanoid:MoveTo(points[node])
		repeat
				local dis = (points[node]-dummy.HumanoidRootPart.Position).magnitude
			wait()
		until dis < 3
	end
else
	print("Computing path unsuccessful")
	end
	end

Not sure this helps you much but I just tried your script in an npc I had in my studio and it worked fine.

You need to give an instance tree. Also, I think there’s some problems with your Code.