API:Class/PathWaypoint/Position

Position

Read-only: This property can only be read from. Attempting to write to it will cause an error.
Property of NavWaypoint.pngPathWaypoint
There are members of the same name. See the disambiguation page.

Value Type: Vector3
Description: The Position property of a PathWaypoint shows where that waypoint is located. When FindPathAsync creates Paths, it will space the waypoints out. In general, waypoints will be about 3 studs apart from one another. If the waypoints are separated by a jump they may be further apart, or if the waypoints are going around a corner they may be closer together.

Example

This example creates a path between two points and creates parts at every waypoint along that path. The code uses the Position property of the PathWaypoints to position the parts.

-- Make variables for Roblox services
local PathfindingService = game:GetService("PathfindingService")
 
-- Make variables for the start and end of the path
local start = Vector3.new(0, 1, 0)
local finish = Vector3.new(25, 1, -60)
 
-- Find the path and get the waypoints
local path = PathfindingService:FindPathAsync(start, finish)
local waypoints = path:GetWaypoints()
 
-- Loop through all of the waypoints in the path
for waypointIndex, waypoint in pairs(waypoints) do
	-- Create a part for each waypoint and position the part
	-- at the waypoint's position.
	local part = Instance.new("Part")
	part.Size = Vector3.new(1, 1, 1)
	part.Position = waypoint.Position
	part.CanCollide = false
	part.Anchored = true
	part.Parent = game.Workspace
end