Pathfinding waypoints returning an empty table

  1. What do you want to achieve? Im trying to make a basic ai that follows a block using pathfinding.

  2. What is the issue? The pathfinding waypoints are returning an empty table.

  3. What solutions have you tried so far? I’ve looked at other post and youtube videos and still getting nothing.

-- 

local HumanoidRootPart = script.Parent.HumanoidRootPart
local Humanoid = script.Parent.Humanoid
local PathFindingService = game:GetService("PathfindingService")

local function WalkTo(Target)
	
	local Path = PathFindingService:CreatePath()
	Path:ComputeAsync(HumanoidRootPart.Position,Target.Position)
	local WayPoints = Path:GetWaypoints()
	
	print(WayPoints)
	for i,v in pairs(WayPoints) do
		Humanoid:MoveTo(Target.Position)
	end
end

WalkTo(workspace.Target)

img

1 Like

Before looking into this, Is the Pathfinding working?

no ive been spending a while trying to figure out why

Is the Path not blocked? If the path is blocked then it will likely return an empty table (though, I myself have not looked into this before so I’m not entirely sure)

nope, its just a single wall and it just dose nothing

ok i found the problem there was a humanoid in workspace and that broke pathfinding for some reason

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.