Why does a Path return as an Instance and not a Path?

Why does PathfindingService:CreatePath() return as an Instance and not a Path?

local Path = Pathfind:CreatePath(agentParams) -- returns an Instance?

Path:ComputeAsync(Start, Finish) -- Not able to See this function?
local Path: Path = Pathfind:CreatePath(agentParams) -- Assigned as Path

Path:ComputeAsync(Start, Finish) -- I can see the Paths Methods and functions?

This is probably a bug, so I would think to post this in #bug-reports.

I don’t think so, It has been like this for a really long time.

Also I don’t have the Regular Trust Level to even use #bug-reports

It returns an Instance that’s of Class “Path”

It’s not a bug, it’s just that the function CreatePath may not say that it returns a type “Path”

Yes, but why?
Why not just Path?

I can’t tell you why it doesn’t return a type Path, possibly because this was implemented before typing and this is one of the things they haven’t gotten around to yet.

The easiest thing to do is just what you’re doing in the second code block where you say “Yes this is a Path”

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