Help with PathfindingService

Hi, my pathfinding script won’t work, and I can’t figure it out. Can anyone help?

code:

local pathfindingService = game:GetService("PathfindingService")

local humanoid = script.Parent:WaitForChild("Humanoid")
local humanoidRootPart = script.Parent:WaitForChild("HumanoidRootPart")
local destination = game.Workspace:WaitForChild("HealthPart").Position

local path = pathfindingService:CreatePath()
script.Parent:GetPropertyChangedSignal("Parent"):Connect(function()
	wait(1.5)
	path:ComputeAsync(humanoidRootPart.Position, destination)

	local waypoints = path:GetWaypoints()

	for k, waypoint in pairs(waypoints) do
		humanoid:MoveTo(waypoint.Position)

		if waypoint.Action == Enum.PathWaypointAction.Jump then
			humanoid.Jump = true
		end

		humanoid.MoveToFinished:Wait()
	end
end)

The PathfindingService related code seems to be fine, maybe the problem is something else. Are you sure that there is a valid path that PathfindingService is able to create? Try using a print to check if path.Status == Enum.PathStatus.Success

1 Like

Yeah I tried to print for everything, and everything printed, but didn’t work.

Pathfindinh service is bugged.

Its not computing paths. It happens to me too.

1 Like