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

How to implement the new path finding service parameters?

It was earlier today when I found out about roblox's new pathfinding service perimeters: Wiki Page and I wanted to tinker with it, but being the idiot I am, I could not figure out how. On the wiki page, it says it's a function of "PathfindingService", and "PathfindingService" is a function which you call like this:

local pathfindingService = game:GetService("PathfindingService")

so I was puzzled as to how to implement the new parameters into it. I obviously can't go and do this:

local pathfindingService = game:GetService("PathfindingService","AgentCanJump" = false)

so how would I pass these parameters in?

1 answer

✓ Accepted answer

PathfindingService, as it's name suggests, is a service of Roblox. You retrieve this service by using the :GetService() function.

local pathfindingService = game:GetService("PathfindingService")

With the above, we can now access the functions that this service provides like :CreatePath(). This function creates a new path object for us to use and has an optional argument. This argument must be a dictionary with the properties you'd like to set.

--You don't need to put all parameters in this dictionary:
local pathParams = {
	AgentHeight = 5, --default
	AgentRadius = 3, --default is 2
	AgentCanJump = false --default is true
}

Available parameters can be seen here.

We can then pass this dictionary into our :CreatePath() function.

local pathfindingService = game:GetService("PathfindingService")


local pathParams = {
	AgentHeight = 5,
	AgentRadius = 3,
	AgentCanJump = false
}

local newPath = pathfindingService:CreatePath(pathParams)

You now have the ability to use the functions under newPath since we used :CreatePath() to make a path object.

#####Let me know if you need something explained or if I had missed anything.

###References:

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