:GetWaypoints() returning an empty table, pathfinding intern not working

So, I’m trying to make a pathfinding system for troops in my new Clash Royale-style project. However, the pathfinding is being finicky again. It’s supposed to do as it should, as all the code is written correctly, but it just doesn’t. From debugging, the :GetWaypoints() function is returning an empty table, despite the fact there are no obstructions and I have given the correct vectors.

Picture of the route:

Code:

wait()

local pathSrv = game:GetService("PathfindingService")
local path = pathSrv:CreatePath()

path:ComputeAsync(script.Parent.HumanoidRootPart.Position, workspace.BlueTower1.Position)

local ways = path:GetWaypoints()
	
print(ways)

for i,v in pairs(ways) do
	script.Parent.Humanoid:MoveTo(v)
	script.Parent.Humanoid.MoveToFinished:Wait()
end

Could anyone help figure out why? Thanks.

2 Likes

Is this a model or a base part)

Is whatever your movings part’s anchored? 'cause if so the thing you wanna move won’t move

It’s a UnionOperation.

Nope, every part of the dummy is unanchored, and the tower is fully anchored.

(Sorry for late replies btw.)

1 Like

do this:

wait()

local pathSrv = game:GetService("PathfindingService")
local path = pathSrv:CreatePath()

path:ComputeAsync(script.Parent.HumanoidRootPart.Position, workspace.BlueTower1.Position)

local ways = path:GetWaypoints()
	
print(ways)

for i,v in pairs(ways) do
	script.Parent.Humanoid:MoveTo(v.Position)
	script.Parent.Humanoid.MoveToFinished:Wait()
end

you probably have to put

script.Parent.Humanoid:MoveTo(v.Position)

instead of

script.Parent.Humanoid:MoveTo(v)
2 Likes