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.