Reference API Roblox

Engine API

Website

Related

Reference API Roblox

Path

Stores the result of paths created by PathfindingService:CreatePath().

This class is not replicated. Its interface does not cross the network boundary.
This class is not creatable. Instances of this class cannot be created with Instance.new.
Tags: [NotCreatable, NotReplicated]

Member index 7

HistoryMember
553Status: PathStatus
462CheckOcclusionAsync(start: int): int
573ComputeAsync(start: Vector3, finish: Vector3): null
553GetPointCoordinates(): Array
462GetWaypoints(): Array
462Blocked(blockedWaypointIdx: int)
491Unblocked(unblockedWaypointIdx: int)
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

Path objects store the result of paths created by PathfindingService:CreatePath().

Once a path object is created, you can call Path:ComputeAsync() with a starting point and ending point. This will attempt to compute a valid path for a character to move along, based on default or custom parameters passed to CreatePath(). If ComputeAsync() successfully finds a path, the Path object will have a Path.Status value of PathStatus.Success. Otherwise the status will be PathStatus.NoPath which can occur if there are obstacles between the two points (and no way around) or if the points are inside of solid objects.

In addition to ComputeAsync(), Path objects have the GetWaypoints() method which returns a list of waypoints representing the points a character should follow in sequence to get from the beginning to the end of the path.

Finally, Path objects can be connected to the Path.Blocked event. This event will fire if, at any time during the path's existence, the path is blocked. Note that this can occur behind a character moving along the path, not just in front of it.

History 19

Members 7

Blocked

Parameters (1)
blockedWaypointIdxint

Fires when the computed path becomes blocked. Note that paths may become blocked somewhere behind the agent, such as a pile of rubble falling on a path as the agent runs away. See Handling Blocked Paths for details on checking the forward waypoint progress of an agent along a path.

History 2

CheckOcclusionAsync

Parameters (1)
startint
Returns (1)
int

This function checks if a path is blocked starting at the waypoint indicated by start.

It returns the first waypoint of occlusion if blocked, -1 if not. it returns an error if start is less than 0 or greater than the number of waypoints in the Path.

This function yields. It will block the calling thread until completion.

History 2

Tags: [Yields]

ComputeAsync

Parameters (2)
startVector3
finishVector3
Returns (1)
null

This function computes a Path from a start position to an end position. This function is not automatically called when a path is created and must be invoked each time the path needs to be updated.

Once the Path is computed, it will have a series of waypoints that, when followed, can lead a character along the path. These points are gathered with the Path:GetWaypoints() function.

This function yields. It will block the calling thread until completion.

History 3

Tags: [Yields]

GetPointCoordinates

Parameters (0)
No parameters.
Returns (1)
Array

This function returns a table of Path instances.

This function is deprecated. It exists only for backward compatibility, and should not be used for new work. GetWaypoints should be used instead.

History 4

Tags: [Deprecated]

GetWaypoints

Parameters (0)
No parameters.
Returns (1)
Array

This function returns an array of all the PathWaypoints in a Path, as computed by Path:ComputeAsync().

Each waypoint in the array specifies a Vector3 position and action to take when this PathWaypoint is reached. The array is arranged in the order of waypoints from the path start to path end.

If a path could not be computed, this function will return an empty array.

History 2

Status

TypeDefault
PathStatus

The success of the generated Path.

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 4

Tags: [ReadOnly, NotReplicated]

Unblocked

Parameters (1)
unblockedWaypointIdxint

Fires when a computed path that was blocked becomes unblocked. Note that a blocked path may become unblocked somewhere behind the agent, effectively making reaction to this event unnecessary. See Handling Blocked Paths for details on checking the forward waypoint progress of an agent along a path.

History 1

Settings