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
The resolved top-left position of this interface element in pixels.
The resolved rotation of this interface element in degrees, including ancestor rotation.
The resolved width and height of this interface element in pixels.
Whether this interface accepts and consumes input.
The normalized point within the element used as the origin for Position.
Whether the button automatically changes color during pointer interaction.
The dimensions that resize to fit the element's content.
The color used to fill the element's background.
The background transparency, from 0 for opaque to 1 for invisible.
The color of the element's border.
Whether the border is drawn outside, across, or inside the element's bounds.
The border thickness in pixels.
Whether descendant rendering is clipped to this element's bounds.
The text content after rich-text markup has been removed.
The corner radius used for the element's rounded background.
The individual corner radii used for the element's rounded background.
Whether pointer dragging can move the element.
The typeface used to render the button text.
Whether the text uses the monospaced font option.
The style applied to the button text.
The weight applied to the button text.
The share of remaining main-axis space assigned to this child in flow layout.
The element's current idle, hover, pressed, or non-interactable state.
Which input events this element consumes before they reach elements behind it.
Whether the element accepts interaction.
Whether children use flow layout or their explicit positions.
The numeric order of this element when a parent layout sorts by layout order.
The additional spacing between text glyphs.
The line-height multiplier used for multi-line button text.
The maximum number of visible graphemes.
Whether the button captures modal interface input.
The interface element selected when navigating down from this element.
The interface element selected when navigating left from this element.
The interface element selected when navigating right from this element.
The interface element selected when navigating up from this element.
The opacity multiplier applied to this element and its descendants.
The element position relative to its parent.
Whether markup in Text is parsed and rendered as rich text.
The interface rotation in degrees.
Whether interface navigation can select this element.
The interface element used to draw the selection indicator.
The numeric order used for interface selection traversal.
The element size relative to its parent.
The parent axes used to resolve relative interface size.
The text displayed by the element.
The resolved pixel bounds of the rendered text.
The color used to render text.
Whether the rendered text fits within the button's bounds.
Whether the engine scales the text to fit the button's bounds.
The base text size in pixels.
The color used for the outline around text glyphs.
The transparency of the outline around text glyphs.
The text transparency, from 0 for opaque to 1 for invisible.
The truncation mode used when text does not fit.
Whether text wraps onto additional lines within the element's width.
The horizontal alignment of text within the element.
The vertical alignment of text within the element.
Whether this interface element is rendered.
The element's draw-order index.
Gives keyboard focus to this interface element.
Returns this instance if it is an ExecutionGroup.
Removes keyboard focus from this interface element.
Fires when the button is activated by an accepted pointer, touch, or gamepad input.
Fires when pointer dragging of the element begins.
Fires when pointer dragging of the element ends.
Fires when input begins over or is dispatched to this interface element.
Fires when input dispatched to this element changes.
Fires when input dispatched to this element ends.
Fires when the mouse wheel scrolls backward over this element.
Fires when the mouse wheel scrolls forward over this element.
Fires when a pointer moves onto the button.
Fires when a pointer moves off the button.
Fires when the pointer moves across the button.
Fires when the button enters its pressed state.
Fires when the button leaves its pressed state.
Fires when interface navigation selects this element.
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 = 0The 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 = trueWhether 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 = trueWhether the button automatically changes color during pointer interaction.
AutomaticSize
TextButton.AutomaticSize: Enum.AutomaticSize = Enum.AutomaticSize.NoneThe 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 = 0The 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.OutlineWhether the border is drawn outside, across, or inside the element's bounds.
BorderSizePixel
TextButton.BorderSizePixel: number = 1The border thickness in pixels.
ClipsDescendants
TextButton.ClipsDescendants: boolean = falseWhether descendant rendering is clipped to this element's bounds.
ContentText
TextButton.ContentText: stringThe text content after rich-text markup has been removed. Read-only.
CornerRadius
TextButton.CornerRadius: number = 0The 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 = falseWhether pointer dragging can move the element.
FontFace
TextButton.FontFace: Font = ""The typeface used to render the button text.
FontMono
TextButton.FontMono: booleanWhether the text uses the monospaced font option.
FontStyle
TextButton.FontStyle: Enum.FontStyle = Enum.FontStyle.NormalThe style applied to the button text.
FontWeight
TextButton.FontWeight: Enum.FontWeight = Enum.FontWeight.RegularThe weight applied to the button text.
Grow
TextButton.Grow: number = 0The share of remaining main-axis space assigned to this child in flow layout.
GuiState
TextButton.GuiState: Enum.GuiState = Enum.GuiState.IdleThe element's current idle, hover, pressed, or non-interactable state.
InputSink
TextButton.InputSink: Enum.InputSink = Enum.InputSink.NoneWhich input events this element consumes before they reach elements behind it.
Interactable
TextButton.Interactable: boolean = trueWhether the element accepts interaction.
Layout
TextButton.Layout: Enum.Layout = Enum.Layout.FlowWhether children use flow layout or their explicit positions.
LayoutOrder
TextButton.LayoutOrder: number = 0The numeric order of this element when a parent layout sorts by layout order.
LetterSpacing
TextButton.LetterSpacing: numberThe additional spacing between text glyphs.
LineHeight
TextButton.LineHeight: numberThe line-height multiplier used for multi-line button text.
MaxVisibleGraphemes
TextButton.MaxVisibleGraphemes: numberThe maximum number of visible graphemes. A negative value shows all graphemes.
Modal
TextButton.Modal: boolean = falseWhether the button captures modal interface input.
NextSelectionDown
TextButton.NextSelectionDown: GuiObject? = nilThe interface element selected when navigating down from this element.
NextSelectionLeft
TextButton.NextSelectionLeft: GuiObject? = nilThe interface element selected when navigating left from this element.
NextSelectionRight
TextButton.NextSelectionRight: GuiObject? = nilThe interface element selected when navigating right from this element.
NextSelectionUp
TextButton.NextSelectionUp: GuiObject? = nilThe interface element selected when navigating up from this element.
Opacity
TextButton.Opacity: number = 1The opacity multiplier applied to this element and its descendants.
Position
The element position relative to its parent. Scale components use the parent size; offsets are in pixels.
RichText
TextButton.RichText: booleanWhether markup in Text is parsed and rendered as rich text.
Rotation
TextButton.Rotation: number = 0The interface rotation in degrees.
Selectable
TextButton.Selectable: boolean = falseWhether interface navigation can select this element.
SelectionImageObject
TextButton.SelectionImageObject: GuiObject? = nilThe interface element used to draw the selection indicator.
SelectionOrder
TextButton.SelectionOrder: number = 0The numeric order used for interface selection traversal.
Size
The element size relative to its parent. Scale components use the parent size; offsets are in pixels.
SizeConstraint
TextButton.SizeConstraint: Enum.SizeConstraint = Enum.SizeConstraint.RelativeXYThe parent axes used to resolve relative interface size.
Text
TextButton.Text: string = "Button"The text displayed by the element.
TextBounds
TextButton.TextBounds: Vector2The 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: booleanWhether the rendered text fits within the button's bounds. Read-only.
TextScaled
TextButton.TextScaled: booleanWhether the engine scales the text to fit the button's bounds.
TextSize
TextButton.TextSize: number = 8The 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 = 1The transparency of the outline around text glyphs.
TextTransparency
TextButton.TextTransparency: number = 0The text transparency, from 0 for opaque to 1 for invisible.
TextTruncate
TextButton.TextTruncate: EnumItemThe truncation mode used when text does not fit.
TextWrapped
TextButton.TextWrapped: boolean = falseWhether text wraps onto additional lines within the element's width.
TextXAlignment
TextButton.TextXAlignment: Enum.TextXAlignment = Enum.TextXAlignment.CenterThe horizontal alignment of text within the element.
TextYAlignment
TextButton.TextYAlignment: Enum.TextYAlignment = Enum.TextYAlignment.CenterThe vertical alignment of text within the element.
Visible
TextButton.Visible: boolean = trueWhether this interface element is rendered.
ZIndex
TextButton.ZIndex: number = 1The 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: RBXScriptSignalFires when the button is activated by an accepted pointer, touch, or gamepad input.
DragBegin
TextButton.DragBegin: RBXScriptSignalFires when pointer dragging of the element begins.
DragStopped
TextButton.DragStopped: RBXScriptSignalFires when pointer dragging of the element ends.
InputBegan
TextButton.InputBegan: RBXScriptSignalFires when input begins over or is dispatched to this interface element.
InputChanged
TextButton.InputChanged: RBXScriptSignalFires when input dispatched to this element changes.
InputEnded
TextButton.InputEnded: RBXScriptSignalFires when input dispatched to this element ends.
MouseWheelBackward
TextButton.MouseWheelBackward: RBXScriptSignalFires when the mouse wheel scrolls backward over this element.
MouseWheelForward
TextButton.MouseWheelForward: RBXScriptSignalFires when the mouse wheel scrolls forward over this element.
PointerEntered
TextButton.PointerEntered: RBXScriptSignalFires when a pointer moves onto the button.
PointerExited
TextButton.PointerExited: RBXScriptSignalFires when a pointer moves off the button.
PointerMoved
TextButton.PointerMoved: RBXScriptSignalFires when the pointer moves across the button.
Pressed
TextButton.Pressed: RBXScriptSignalFires when the button enters its pressed state.
Released
TextButton.Released: RBXScriptSignalFires when the button leaves its pressed state.
SelectionGained
TextButton.SelectionGained: RBXScriptSignalFires when interface navigation selects this element.
SelectionLost
TextButton.SelectionLost: RBXScriptSignalFires when this element loses interface selection.
Inherited members
- Properties
- CatchesPointer
- Properties
- ArchivableClassNameNameParent
- Methods
- AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
- Events
- AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying
Example
local button = Instance.new("TextButton")
button.Text = "Save"
button.Activated:Connect(function()
print("save")
end)