PathfindingService is used to find logical paths between two points,
ensuring that characters can move between the points without running into
walls or other obstacles. By default, the shortest path is calculated, but you
can implement pathfinding modifiers to compute smarter paths across various
materials, around defined regions, or through obstacles.
This function computes and returns a Path between two
Vector3s. If the given MaxDistance is greater than 512,
an error will be thrown. (MaxDistance is too large).
This function is deprecated. It exists only for backward compatibility, and should not be used for new work. FindPathAsync should be used instead.
This function yields. It will block the calling thread until completion.
This function computes and returns a smooth Path between two
Vector3s. This function fulfills the same purpose as
PathfindingService:ComputeRawPathAsync(), but creates a much
smoother path for an NPC to follow in comparison.
This function is deprecated. It exists only for backward compatibility, and should not be used for new work. FindPathAsync should be used instead.
This function yields. It will block the calling thread until completion.
Creates a Path object based on various agent parameters. Valid
keys and values in the agentParameters table are as follows:
Key
Type
Default
Description
AgentRadius
integer
2
Determines the minimum amount of horizontal space required
for empty space to be considered traversable.
AgentHeight
integer
5
Determines the minimum amount of vertical space required
for empty space to be considered traversable.
AgentCanJump
boolean
true
Determines whether jumping during pathfinding is
allowed.
AgentCanClimb
boolean
false
Determines whether climbing TrussParts
during pathfinding is allowed.
WaypointSpacing
number
4
Determines the spacing between intermediate waypoints in
path.
Costs
table
{}
Table of materials or defined
PathfindingModifiers and their
"cost" for traversal. Useful for making the agent prefer
certain materials/regions over others. See here for details.
This function is used to find a Path between two provided points.
This path uses the navigation grid created by PathfindingService
and makes sure that the path can be followed by a regular-sized Roblox
character.
This function returns a Path object which contains the coordinates
of the path. If no path is found between the two points, this function
will still return a Path object, but that object's
Path.Status will be PathStatus.NoPath.