Hi,
I encounter this problem where Pathfinding is acting strange and not working. I have the following code:
function mobPathFinding(mob)
local pathFinding = game:GetService("PathfindingService")
local path = pathFinding:CreatePath()
local target = game.Workspace:WaitForChild("target")
local success, err = pcall(function()
path:ComputeAsync(mob.PrimaryPart.Position, target.PrimaryPart.Position)
end)
if success and path.Status == Enum.PathStatus.Success then
local waypoints = path:GetWaypoints()
for _, w in pairs(waypoints) do
mob:MoveTo(w.Position)
wait(.1)
end
else
warn(err)
end
end
If I write like this path:ComputeAsync(mob.PrimaryPart.Position, target.PrimaryPart.Position + Vector3.New(1, 0, 0))
then is computing the path. I don’t understand why is going like that. Any suggestions?