Glorpia Docs
Instances

TextButton

A clickable text GUI object for client-side interfaces inside ScreenGui, SurfaceGui, BillboardGui and other valid GUI containers.

Properties

NameTypeDescription
SizeUDim2Default: UDim2.new(0, 100, 0, 50).
PositionUDim2Position relative to the parent GUI. Default: UDim2.new(0, 0, 0, 0).
AnchorPointVector2Point inside the TextButton that Position is anchored to. Default: Vector2.new(0, 0).
BackgroundColour3Colour3Background colour. Default: white. BackgroundColor3 is an alias.
BackgroundTransparencynumberBackground transparency from 0 through 1. Default: 0.
TextstringDisplayed text. Default: TextButton.
TextSizenumberText size in pixels. Default: 14.
TextFitsbooleanRead-only. True when the current rendered text fits inside the TextButton bounds.
TextScaledbooleanScales text to the largest size that still fits inside the button. Enabling TextScaled also enables TextWrapped. Default: false.
TextWrappedbooleanWraps text inside the button. Disabling TextWrapped also disables TextScaled. Default: false.
TextTruncateEnum.TextTruncateControls text truncation. Default: Enum.TextTruncate.None.
TextDirectionEnum.TextDirectionControls text flow direction. Default: Enum.TextDirection.Auto.
TextXAlignmentEnum.TextXAlignmentHorizontal text alignment. Default: Enum.TextXAlignment.Center.
TextYAlignmentEnum.TextYAlignmentVertical text alignment. Default: Enum.TextYAlignment.Center.
TextTransparencynumberText transparency from 0 through 1. Default: 0.
TextColour3Colour3Text colour. Default: black. TextColor3 is an alias.
FontEnum.FontFont family. Uses the same Enum.Font families as TextLabel. Default: Enum.Font.Metropolis.
FontStyleEnum.FontStyleFont style supported by the selected Font. Default: Enum.FontStyle.Normal.
VisiblebooleanControls whether the TextButton is drawn. Default: true.
RotationnumberClockwise rotation in degrees around the button centre. Default: 0.
ZIndexnumberSibling-scoped GUI draw order. Higher values draw above sibling GUI objects. Descendants remain inside the parent stacking context. Default: 1.
ClipDescendantsbooleanClips GUI descendants to the TextButton bounds. Default: false.
InteractablebooleanControls whether the button participates in pointer interaction. Default: true.
ModalbooleanWhen true, right-click camera movement is allowed through this GUI object while the pointer is over it. Default: false.
BorderColour3Colour3Border colour. Default: black. BorderColor3 is an alias.
BorderModeEnum.BorderModeBorder placement. Default: Enum.BorderMode.Outline.
BorderSizePixelnumberBorder thickness in pixels. Default: 0. Disabled in Studio while a UICorner is parented to the TextButton.
ActivebooleanControls whether the button accepts pointer input. Default: true.
AutoButtonColourbooleanWhen true, automatic hover and pressed colour feedback is applied. AutoButtonColor is an alias. Default: true.
AutoButtonColour3Colour3Colour multiplier used by automatic hover and pressed feedback. AutoButtonColor3 is an alias. Default: white.

Signals

NameTypeDescription
ActivatedsignalFires after a completed activation.
MouseButton1ClicksignalFires when primary input is pressed and released over the same active TextButton.
MouseButton1DownsignalFires when primary input begins over the active TextButton.
MouseButton1UpsignalFires when the primary input that began on the button is released.
TextButton pointer signals are client input. Public creator scripts connect to them from a LocalScript. Studio autocomplete inserts button signal members as :Connect() calls.

Example

Luau
local button = Instance.new("TextButton")
button.Size = UDim2.new(0, 160, 0, 48)
button.AnchorPoint = Vector2.new(0, 0)
button.Text = "Play"
button.TextScaled = true
button.TextXAlignment = Enum.TextXAlignment.Center
button.TextYAlignment = Enum.TextYAlignment.Center
button.BackgroundColour3 = Colour3.fromRGB(88, 255, 106)
button.TextColour3 = Colour3.fromRGB(0, 0, 0)
button.TextTransparency = 0
button.Active = true
button.Interactable = true
button.AutoButtonColour3 = Colour3.fromRGB(255, 255, 255)
button.Parent = workspace.Part.BillboardGui

button.MouseButton1Click:Connect(function()
    print("Clicked")
end)

Related