Path2D is a UI instance that represents a 2D spline. It can be placed under any GuiObject and be edited directly in the viewport using built‑in tooling. Path2D stores control points and exposes methods to sample positions along the curve, enabling curved UI layouts, path‑based animations, and interactive tools like graph editors and visual effects.
See the 2D paths guide for more information and usage examples.
When set to true, the path forms a closed loop by connecting the last control point back to the first. The closure only takes effect when the path has at least 3 control points. Defaults to false.
Field
Value
type
boolean
security
{"read":"None","write":"None"}
thread safety
ReadSafe
category
Data
serialization
{"can_load":true,"can_save":true}
capabilities
["UI"]
Path2D.Color3
Determines the stroke color used to render the Path2D. Defaults to [0, 0, 0] (black). A child UIGradient can override the solid color with a gradient fill.
Field
Value
type
Color3
security
{"read":"None","write":"None"}
thread safety
ReadSafe
category
Data
serialization
{"can_load":true,"can_save":true}
capabilities
["UI"]
Path2D.SelectedControlPoint
The 1-based index of the currently selected control point. Defaults to 1 and is clamped to the range [1, number of control points]. Changing this value updates Path2D.SelectedControlPointData to reflect the control point at the new index.
Determines the stroke width of the Path2D in pixels. Defaults to 1 and is clamped to the range [0, 100].
Field
Value
type
float
security
{"read":"None","write":"None"}
thread safety
ReadSafe
category
Data
serialization
{"can_load":true,"can_save":true}
capabilities
["UI"]
Path2D.Visible
Determines if the Path2D path is rendered or not. When false, the path will not render. However, any modifications to the control points will update correctly, ensuring that querying data will have the correct info.
Field
Value
type
boolean
security
{"read":"None","write":"None"}
thread safety
ReadSafe
category
Data
serialization
{"can_load":true,"can_save":true}
capabilities
["UI"]
Path2D.ZIndex
Determines the order in which a Path2D path renders relative to other GUIs. Works the same as GuiObject.ZIndex but does not interact with layout order in any way.
Returns the Rect bounding size for the Path2D. This is computed based on the control points and is not modifiable outside of changing the control point data.
Returns
Type
Description
Rect
The Rect bounding box that encloses the path, expanded by its rendered thickness.
Field
Value
security
None
thread safety
Unsafe
capabilities
["UI"]
Path2D:GetControlPoint
Returns the Path2DControlPoint for a given index. If the index is out of bounds, this method will throw an error.
The maximum number of control points a Path2D supports.
Field
Value
security
None
thread safety
Unsafe
capabilities
["UI"]
Path2D:GetPositionOnCurve
Returns the 2D UDim2 position at a given t value between 0 and 1 (inclusive), representing the parameter space result of querying the spline. The values will be more tightly packed near bends and wider apart in straighter segments; see GetPositionOnCurveArcLength() for even spacing results.
Throws an error if the Path2D has less than two control points.
Returns the 2D UDim2 position at a given t value between 0 and 1 (inclusive), representing the arc length space result of querying the spline. The values will be evenly spaced along the spline; see GetPositionOnCurve() for parameter spacing results.
Throws an error if the Path2D has less than two control points.
Parameters
Name
Type
Default
Description
t
float
The value to query the Path2D at.
Returns
Type
Description
UDim2
The position in arc length space.
Field
Value
security
None
thread safety
Unsafe
capabilities
["UI"]
Path2D:GetTangentOnCurve
Returns the tangent at a given t value in parameter space where t is a value between 0 and 1 (inclusive). Throws an error if the Path2D has less than two control points.
Returns the tangent at a given t value in arc length space where t is a value between 0 and 1 (inclusive). Throws an error if the Path2D has less than two control points.
Inserts a new Path2DControlPoint at a given index. Throws a warning if the index is out of bounds or if you're trying to add control points past the limit of 50.
Parameters
Name
Type
Default
Description
index
int
The index to insert at.
point
Path2DControlPoint
The control point to insert.
Returns
Type
Description
()
Field
Value
security
None
thread safety
Unsafe
capabilities
["UI"]
Path2D:RemoveControlPoint
Removes a control point at the given index. Throws a warning if the index is out of bounds.
Parameters
Name
Type
Default
Description
index
int
The index to remove at.
Returns
Type
Description
()
Field
Value
security
None
thread safety
Unsafe
capabilities
["UI"]
Path2D:SetControlPoints
Sets all the control points to the specified array, replacing all existing points with new ones. Throws a warning if there are more than 50 points in the controlPoints array.
Parameters
Name
Type
Default
Description
controlPoints
Array
The new list of control points to set.
Returns
Type
Description
()
Field
Value
security
None
thread safety
Unsafe
capabilities
["UI"]
Path2D:UpdateControlPoint
Updates the control point at the given index. Throws a warning if the index is out of range.