Pathfinding always returns nil

I want to do pathfinding
Engine returns ALWAYS nil, yes literally there nothing can be done to prevent it
hower debugging tools are indeed seeing it

I’ve looked in literally every post i seen yet nobody spoken about it before, could be a bug?

local PathfindingService = game:GetService("PathfindingService")

local folder = workspace:WaitForChild("e")

local start = folder:WaitForChild("Start")
local marker = folder:WaitForChild("Point")
local goal = folder:WaitForChild("goal")

local path = PathfindingService:CreatePath()

local fr= path:ComputeAsync(start.Position,goal.Position)


print(fr)

 

image

path:ComputeAsync doesn’t return anything, you have to call path:GetWaypoints to get the waypoints.

3 Likes

Can you please look at attachments?Im not stuipid
Thanks

i suspect that roblox force my roblox studio to toggle random beta feature without my knowledge
Otherwise it could be a bug.Thanks all for trying to help but next time please look at attachments

Not sure why your getting iffy, looking at the attachments, I dont see GetWaypoints anywhere. Use GetWaypoints in the script, so instead of

local fr= path:ComputeAsync(start.Position,goal.Position)

have

local fr= path:GetWaypoints(start.Position,goal.Position)

how could you use method on nil? bro :skull::skull:
by the way this issue is still not solved i gonna try looking at beta features

Well we’re tryna help, and its not “path” returning nil, it’s your “fr”, which your not using a method on.

Not sure why your so toxic when were tryna help :+1:

Oh im sorry i dont trying to be toxic
I just dont understand why pathfinding returns nil
also no your solution does not work i tried it

i just tested removing beta features and it does not help
i prob should open bug report for it
But i dont have access to such category i think

:ComputeAsync() not returning anything isn’t a bug. As previously explained by @CloudSnooze :ComputeAsync() doesn’t return anything on purpose and instead computes a created paths waypoints. To actually get the paths waypoints you have to call :GetWaypoints() on the path you made using :CreatePath().

Doesn’t work as :ComputeAsync() only computes a path and does not return its waypoints:

local PathfindingService = game:GetService("PathfindingService")

local folder = workspace:WaitForChild("e")

local start = folder:WaitForChild("Start")
local marker = folder:WaitForChild("Point")
local goal = folder:WaitForChild("goal")

local path = PathfindingService:CreatePath()

local fr= path:ComputeAsync(start.Position,goal.Position) --Doesn't return anything


print(fr)

The correct implementation would look like this:

local PathfindingService = game:GetService("PathfindingService")

local folder = workspace:WaitForChild("e")

local start = folder:WaitForChild("Start")
local marker = folder:WaitForChild("Point")
local goal = folder:WaitForChild("goal")

local path = PathfindingService:CreatePath()

path:ComputeAsync(start.Position,goal.Position) --Computes the path and doesn't return anything

local fr = path:GetWaypoints() --Actually returns the previously computed waypoints

print(fr)

If you need any additional help you can refer to the official documentation on paths:

2 Likes

oh my god Thank you so much
I were breaking head in attempts to find it

1 Like

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