Open Asterune
TextButton

TextButton

A text-bearing interactive GUI button.

Creatable
Instance.new("TextButton")
Inherits
GuiButtonGuiObjectGuiBase2dGuiBaseInstance
Replication
Standard

Behavior

TextButton displays text and receives pointer or gamepad activation. It combines the text properties of a label with button activation events.

Summary

Members77
Properties59
Methods3
Events15
  • Activated: RBXScriptSignalparallel read

    Fires when the button is activated by an accepted pointer, touch, or gamepad input.

  • DragBegin: RBXScriptSignalparallel readdeprecated

    Fires when pointer dragging of the element begins.

  • DragStopped: RBXScriptSignalparallel readdeprecated

    Fires when pointer dragging of the element ends.

  • InputBegan: RBXScriptSignalparallel read

    Fires when input begins over or is dispatched to this interface element.

  • InputChanged: RBXScriptSignalparallel read

    Fires when input dispatched to this element changes.

  • InputEnded: RBXScriptSignalparallel read

    Fires when input dispatched to this element ends.

  • MouseWheelBackward: RBXScriptSignalparallel read

    Fires when the mouse wheel scrolls backward over this element.

  • MouseWheelForward: RBXScriptSignalparallel read

    Fires when the mouse wheel scrolls forward over this element.

  • PointerEntered: RBXScriptSignalparallel read

    Fires when a pointer moves onto the button.

  • PointerExited: RBXScriptSignalparallel read

    Fires when a pointer moves off the button.

  • PointerMoved: RBXScriptSignalparallel read

    Fires when the pointer moves across the button.

  • Pressed: RBXScriptSignalparallel read

    Fires when the button enters its pressed state.

  • Released: RBXScriptSignalparallel read

    Fires when the button leaves its pressed state.

  • SelectionGained: RBXScriptSignalparallel read

    Fires when interface navigation selects this element.

  • SelectionLost: RBXScriptSignalparallel read

    Fires when this element loses interface selection.

Properties

AbsolutePosition

TextButton.AbsolutePosition: Vector2 = Vector2.new(0, 0)

The resolved top-left position of this interface element in pixels.

AbsoluteRotation

TextButton.AbsoluteRotation: number = 0

The resolved rotation of this interface element in degrees, including ancestor rotation.

AbsoluteSize

TextButton.AbsoluteSize: Vector2 = Vector2.new(0, 0)

The resolved width and height of this interface element in pixels.

Active

TextButton.Active: boolean = true

Whether this interface accepts and consumes input.

AnchorPoint

TextButton.AnchorPoint: Vector2 = Vector2.new(0, 0)

The normalized point within the element used as the origin for Position. (0, 0) is the top-left corner; (0.5, 0.5) is the center.

AutoButtonColor

TextButton.AutoButtonColor: boolean = true

Whether the button automatically changes color during pointer interaction.

AutomaticSize

TextButton.AutomaticSize: Enum.AutomaticSize = Enum.AutomaticSize.None

The dimensions that resize to fit the element's content.

BackgroundColor3

TextButton.BackgroundColor3: Color3 = Color3.new(0.6392157, 0.63529414, 0.64705884)

The color used to fill the element's background.

BackgroundTransparency

TextButton.BackgroundTransparency: number = 0

The background transparency, from 0 for opaque to 1 for invisible.

BorderColor3

TextButton.BorderColor3: Color3 = Color3.new(0.105882354, 0.16470589, 0.20784314)

The color of the element's border.

BorderMode

TextButton.BorderMode: Enum.BorderMode = Enum.BorderMode.Outline

Whether the border is drawn outside, across, or inside the element's bounds.

BorderSizePixel

TextButton.BorderSizePixel: number = 1

The border thickness in pixels.

ClipsDescendants

TextButton.ClipsDescendants: boolean = false

Whether descendant rendering is clipped to this element's bounds.

ContentText

TextButton.ContentText: string

The text content after rich-text markup has been removed. Read-only.

CornerRadius

TextButton.CornerRadius: number = 0

The corner radius used for the element's rounded background.

Corners

TextButton.Corners: { number } = {}

The individual corner radii used for the element's rounded background.

Draggable

TextButton.Draggable: boolean = false

Whether pointer dragging can move the element.

FontFace

TextButton.FontFace: Font = ""

The typeface used to render the button text.

FontMono

TextButton.FontMono: boolean

Whether the text uses the monospaced font option.

FontStyle

TextButton.FontStyle: Enum.FontStyle = Enum.FontStyle.Normal

The style applied to the button text.

FontWeight

TextButton.FontWeight: Enum.FontWeight = Enum.FontWeight.Regular

The weight applied to the button text.

Grow

TextButton.Grow: number = 0

The share of remaining main-axis space assigned to this child in flow layout.

GuiState

TextButton.GuiState: Enum.GuiState = Enum.GuiState.Idle

The element's current idle, hover, pressed, or non-interactable state.

InputSink

TextButton.InputSink: Enum.InputSink = Enum.InputSink.None

Which input events this element consumes before they reach elements behind it.

Interactable

TextButton.Interactable: boolean = true

Whether the element accepts interaction.

Layout

TextButton.Layout: Enum.Layout = Enum.Layout.Flow

Whether children use flow layout or their explicit positions.

LayoutOrder

TextButton.LayoutOrder: number = 0

The numeric order of this element when a parent layout sorts by layout order.

LetterSpacing

TextButton.LetterSpacing: number

The additional spacing between text glyphs.

LineHeight

TextButton.LineHeight: number

The line-height multiplier used for multi-line button text.

MaxVisibleGraphemes

TextButton.MaxVisibleGraphemes: number

The maximum number of visible graphemes. A negative value shows all graphemes.

Modal

TextButton.Modal: boolean = false

Whether the button captures modal interface input.

NextSelectionDown

TextButton.NextSelectionDown: GuiObject? = nil

The interface element selected when navigating down from this element.

NextSelectionLeft

TextButton.NextSelectionLeft: GuiObject? = nil

The interface element selected when navigating left from this element.

NextSelectionRight

TextButton.NextSelectionRight: GuiObject? = nil

The interface element selected when navigating right from this element.

NextSelectionUp

TextButton.NextSelectionUp: GuiObject? = nil

The interface element selected when navigating up from this element.

Opacity

TextButton.Opacity: number = 1

The opacity multiplier applied to this element and its descendants.

Position

TextButton.Position: UDim2 = UDim2.new(0, 0, 0, 0)

The element position relative to its parent. Scale components use the parent size; offsets are in pixels.

RichText

TextButton.RichText: boolean

Whether markup in Text is parsed and rendered as rich text.

Rotation

TextButton.Rotation: number = 0

The interface rotation in degrees.

Selectable

TextButton.Selectable: boolean = false

Whether interface navigation can select this element.

SelectionImageObject

TextButton.SelectionImageObject: GuiObject? = nil

The interface element used to draw the selection indicator.

SelectionOrder

TextButton.SelectionOrder: number = 0

The numeric order used for interface selection traversal.

Size

TextButton.Size: UDim2 = UDim2.new(0, 0, 0, 0)

The element size relative to its parent. Scale components use the parent size; offsets are in pixels.

SizeConstraint

The parent axes used to resolve relative interface size.

Text

TextButton.Text: string = "Button"

The text displayed by the element.

TextBounds

TextButton.TextBounds: Vector2

The resolved pixel bounds of the rendered text. Read-only.

TextColor3

TextButton.TextColor3: Color3 = Color3.new(0, 0, 0)

The color used to render text.

TextFits

TextButton.TextFits: boolean

Whether the rendered text fits within the button's bounds. Read-only.

TextScaled

TextButton.TextScaled: boolean

Whether the engine scales the text to fit the button's bounds.

TextSize

TextButton.TextSize: number = 8

The base text size in pixels.

TextStrokeColor3

TextButton.TextStrokeColor3: Color3 = Color3.new(0, 0, 0)

The color used for the outline around text glyphs.

TextStrokeTransparency

TextButton.TextStrokeTransparency: number = 1

The transparency of the outline around text glyphs.

TextTransparency

TextButton.TextTransparency: number = 0

The text transparency, from 0 for opaque to 1 for invisible.

TextTruncate

TextButton.TextTruncate: EnumItem

The truncation mode used when text does not fit.

TextWrapped

TextButton.TextWrapped: boolean = false

Whether text wraps onto additional lines within the element's width.

TextXAlignment

TextButton.TextXAlignment: Enum.TextXAlignment = Enum.TextXAlignment.Center

The horizontal alignment of text within the element.

TextYAlignment

TextButton.TextYAlignment: Enum.TextYAlignment = Enum.TextYAlignment.Center

The vertical alignment of text within the element.

Visible

TextButton.Visible: boolean = true

Whether this interface element is rendered.

ZIndex

TextButton.ZIndex: number = 1

The element's draw-order index. Interpretation depends on the root's ZIndexBehavior.

Methods

CaptureFocus

TextButton:CaptureFocus(): ()

Gives keyboard focus to this interface element.

GetExecutionGroup

TextButton:GetExecutionGroup(): ExecutionGroup?

Returns this instance if it is an ExecutionGroup. Otherwise returns the nearest ancestor ExecutionGroup, or nil when no group contains the instance.

ReleaseFocus

TextButton:ReleaseFocus(): ()

Removes keyboard focus from this interface element.

Events

Activated

TextButton.Activated: RBXScriptSignal

Fires when the button is activated by an accepted pointer, touch, or gamepad input.

DragBegin

TextButton.DragBegin: RBXScriptSignal

Fires when pointer dragging of the element begins.

DragStopped

TextButton.DragStopped: RBXScriptSignal

Fires when pointer dragging of the element ends.

InputBegan

TextButton.InputBegan: RBXScriptSignal

Fires when input begins over or is dispatched to this interface element.

InputChanged

TextButton.InputChanged: RBXScriptSignal

Fires when input dispatched to this element changes.

InputEnded

TextButton.InputEnded: RBXScriptSignal

Fires when input dispatched to this element ends.

MouseWheelBackward

TextButton.MouseWheelBackward: RBXScriptSignal

Fires when the mouse wheel scrolls backward over this element.

MouseWheelForward

TextButton.MouseWheelForward: RBXScriptSignal

Fires when the mouse wheel scrolls forward over this element.

PointerEntered

TextButton.PointerEntered: RBXScriptSignal

Fires when a pointer moves onto the button.

PointerExited

TextButton.PointerExited: RBXScriptSignal

Fires when a pointer moves off the button.

PointerMoved

TextButton.PointerMoved: RBXScriptSignal

Fires when the pointer moves across the button.

Pressed

TextButton.Pressed: RBXScriptSignal

Fires when the button enters its pressed state.

Released

TextButton.Released: RBXScriptSignal

Fires when the button leaves its pressed state.

SelectionGained

TextButton.SelectionGained: RBXScriptSignal

Fires when interface navigation selects this element.

SelectionLost

TextButton.SelectionLost: RBXScriptSignal

Fires when this element loses interface selection.

Inherited members

Inherited48

Example

Luau
local button = Instance.new("TextButton")
button.Text = "Save"
button.Activated:Connect(function()
  print("save")
end)

GuiButton · TextLabel · InputService