Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

FindPathAsync is not a valid member of Path "Instance"? (ROBLOX PATHFINDING)

I am working with roblox's path finding service and i have a code but it seems to not work for some reason i get this error FindPathAsync is not a valid member of Path "Instance" and the error is coming form line 16

My code:

local torso = script.Parent.Torso


local config = {
	["AgentHeight"] = torso.Size.Y,
	["AgentRadius"] = torso.Size.X,
	["AgentCanJump"] = true
}

while true do
	local finish = workspace.Destination
	local start = script.Parent:FindFirstChild("HumanoidRootPart")
	local service = game:GetService("PathfindingService"):CreatePath(config)
	local humanoid = script.Parent:FindFirstChild("Humanoid")
	
	local path = service:FindPathAsync(torso.Position,finish.Position)
	local points = path:GetWaypoints()

	
	for k,v in pairs(points) do
		humanoid:MoveTo(v.Position)
	end
	wait(0.4)
end

1 answer

You aren't defining PathFindService properly. You must define the service, then define a path afterwards, not together. You are also using depreciated code. Most services and instances have proper guides on how to use them on https://developer.roblox.com/ Before you look at other peoples code or guides look there first. Most guides and code are outdated and won't work anymore. https://developer.roblox.com/en-us/articles/Pathfinding

2 comments

0

@WizyTheNinga would you mind adding some example code?

0

Look at the link I posted. It literally explains how to make a pathfinding script from scratch. I think it explains pathfinding well enough for you to understand it.

This discussion is preserved as it was. New answers, comments, and votes are closed.