Skip to Content
Kinemium

TextButton

A clickable button that displays text.

TextButton combines the text properties of TextLabel with the button behavior of GuiButton. It supports the Activated event and automatic hover and press coloring.

Getting started

local button = Instance.new("TextButton")
button.Size = UDim2.fromOffset(160, 44)
button.Text = "Start"
button.TextSize = 20
button.Parent = screenGui

button.Activated:Connect(function()
    print("started")
end)

Text properties

TextButton exposes the same text members as TextLabel:

PropertyTypeAccessDescription
TextstringRead/writeButton caption. Defaults to "Button".
FontEnum.FontRead/writeLegacy font selector.
FontFaceFontRead/writeFont object.
FontSizeEnum.FontSizeRead/writeNamed size preset.
TextSizenumberRead/writeSize in pixels. Defaults to 16.
TextColor3Color3Read/writeCaption color. Defaults to white.
TextTransparencynumberRead/writeCaption transparency.
TextStrokeColor3Color3Read/writeOutline color.
TextStrokeTransparencynumberRead/writeOutline transparency. Defaults to fully transparent.
TextStrokeThicknessnumberRead/writeOutline width.
TextWrappedbooleanRead/writeWrap long captions.
TextScaledbooleanRead/writeScale text to the button.
TextXAlignmentEnum.TextXAlignmentRead/writeHorizontal alignment, centered by default.
TextYAlignmentEnum.TextYAlignmentRead/writeVertical alignment, centered by default.
LineHeightnumberRead/writeLine spacing multiplier.
TextPaddingnumberRead/writeInner padding in pixels.
RichTextbooleanRead/writeParse inline rich text tags.

Button behavior

TextButton inherits from GuiButton, so it has the button members, including AutoButtonColor, Modal, Selected, and the Activated event. See GuiObject for layout and appearance.

With automatic button color enabled, the background brightens on hover and darkens while pressed.

Notes

  • Activated fires on a completed click, including touch input.
  • The text properties are stored on the button itself; there's no child label instance.
  • Assigning Text invalidates the cached layout.
  • Font changes also invalidate the layout.

See also

  • TextLabel for non-clickable text.
  • ImageButton for an image-based button.
  • GuiObject for shared GUI members.

On this page