For the complete documentation index, see llms.txt. This page is also available as Markdown.

UIStroke

UIStroke : Instance

Overview

UIStroke is an object that displays a stroke along the border of its parent UI object or around text. You can configure properties such as the stroke color, thickness, transparency, position, and corner join style to emphasize UI elements or improve their visibility.

To use UIStroke, place it as a child of the UI object to which you want to apply an outline, such as a Frame or TextLabel.

Properties

ApplyStrokeMode

Enum.ApplyStrokeMode

Specifies how the stroke is applied to the parent UI element.

  • Border: Displays the stroke along the border of the parent UI element.

  • Contextual: Displays the stroke in an appropriate area depending on the type of the parent UI element. For text UI elements, the stroke is displayed around the text.

Contextual can only be set for text UI elements such as TextLabel and TextButton.

Code Samples

local TextLabel = script.Parent
local UIStroke = TextLabel:WaitForChild("UIStroke")

UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border

BorderOffset

UDim

Adjusts the position of the stroke relative to the border of the parent UI element.

Scale represents a proportion of the parent UI element's size, while Offset represents an additional distance in pixels. The value is specified in the UDim.new(scale, offset) format.

This property can only be specified when the stroke is displayed along the border of the parent UI element.

Code Samples

BorderStrokePosition

Enum.BorderStrokePosition

Specifies where the stroke is displayed relative to the border of the parent UI element.

  • Inner: Displays the stroke inside the border.

  • Center: Displays the stroke centered on the border.

  • Outer: Displays the stroke outside the border.

This property can only be specified when the stroke is displayed along the border of the parent UI element.

Code Samples

Color

Color3

Specifies the color applied to the stroke.

Code Samples

Enabled

boolean

Specifies whether the stroke is displayed.

Code Samples

LineJoinMode

Enum.LineJoinMode

Specifies how stroke segments are joined at corners.

  • Round: Joins corners with a rounded shape.

  • Bevel: Joins corners with a beveled shape.

  • Miter: Joins corners with a sharp shape.

Code Samples

StrokeSizingMode

Enum.StrokeSizingMode

Specifies how the stroke thickness is calculated when the size of the parent UI element changes.

  • FixedSize: Maintains a constant stroke thickness regardless of the size of the parent UI element.

  • ScaledSize: Adjusts the stroke thickness proportionally to the size of the parent UI element.

Code Samples

Thickness

number

Specifies the thickness of the stroke.

Higher values display a thicker stroke. The actual appearance may be affected by the StrokeSizingMode setting.

Code Samples

Transparency

number

Specifies the transparency of the stroke.

A value of 0 represents a fully opaque stroke, while 1 represents a fully transparent stroke.

Code Samples

ZIndex

number

Specifies the display priority when the stroke overlaps with other UIStroke objects.

Higher values are displayed with higher priority.

This property can only be specified when the stroke is displayed along the border of the parent UI element.

Code Samples

Methods

Events

See also

GUI

Last updated