Instances
TextButton
A clickable text GUI object for client-side interfaces inside ScreenGui, SurfaceGui, BillboardGui and other valid GUI containers.
Properties
| Name | Type | Description |
|---|---|---|
Size | UDim2 | Default: UDim2.new(0, 100, 0, 50). |
Position | UDim2 | Position relative to the parent GUI. Default: UDim2.new(0, 0, 0, 0). |
AnchorPoint | Vector2 | Point inside the TextButton that Position is anchored to. Default: Vector2.new(0, 0). |
BackgroundColour3 | Colour3 | Background colour. Default: white. BackgroundColor3 is an alias. |
BackgroundTransparency | number | Background transparency from 0 through 1. Default: 0. |
Text | string | Displayed text. Default: TextButton. |
TextSize | number | Text size in pixels. Default: 14. |
TextFits | boolean | Read-only. True when the current rendered text fits inside the TextButton bounds. |
TextScaled | boolean | Scales text to the largest size that still fits inside the button. Enabling TextScaled also enables TextWrapped. Default: false. |
TextWrapped | boolean | Wraps text inside the button. Disabling TextWrapped also disables TextScaled. Default: false. |
TextTruncate | Enum.TextTruncate | Controls text truncation. Default: Enum.TextTruncate.None. |
TextDirection | Enum.TextDirection | Controls text flow direction. Default: Enum.TextDirection.Auto. |
TextXAlignment | Enum.TextXAlignment | Horizontal text alignment. Default: Enum.TextXAlignment.Center. |
TextYAlignment | Enum.TextYAlignment | Vertical text alignment. Default: Enum.TextYAlignment.Center. |
TextTransparency | number | Text transparency from 0 through 1. Default: 0. |
TextColour3 | Colour3 | Text colour. Default: black. TextColor3 is an alias. |
Font | Enum.Font | Font family. Uses the same Enum.Font families as TextLabel. Default: Enum.Font.Metropolis. |
FontStyle | Enum.FontStyle | Font style supported by the selected Font. Default: Enum.FontStyle.Normal. |
Visible | boolean | Controls whether the TextButton is drawn. Default: true. |
Rotation | number | Clockwise rotation in degrees around the button centre. Default: 0. |
ZIndex | number | Sibling-scoped GUI draw order. Higher values draw above sibling GUI objects. Descendants remain inside the parent stacking context. Default: 1. |
ClipDescendants | boolean | Clips GUI descendants to the TextButton bounds. Default: false. |
Interactable | boolean | Controls whether the button participates in pointer interaction. Default: true. |
Modal | boolean | When true, right-click camera movement is allowed through this GUI object while the pointer is over it. Default: false. |
BorderColour3 | Colour3 | Border colour. Default: black. BorderColor3 is an alias. |
BorderMode | Enum.BorderMode | Border placement. Default: Enum.BorderMode.Outline. |
BorderSizePixel | number | Border thickness in pixels. Default: 0. Disabled in Studio while a UICorner is parented to the TextButton. |
Active | boolean | Controls whether the button accepts pointer input. Default: true. |
AutoButtonColour | boolean | When true, automatic hover and pressed colour feedback is applied. AutoButtonColor is an alias. Default: true. |
AutoButtonColour3 | Colour3 | Colour multiplier used by automatic hover and pressed feedback. AutoButtonColor3 is an alias. Default: white. |
Signals
| Name | Type | Description |
|---|---|---|
Activated | signal | Fires after a completed activation. |
MouseButton1Click | signal | Fires when primary input is pressed and released over the same active TextButton. |
MouseButton1Down | signal | Fires when primary input begins over the active TextButton. |
MouseButton1Up | signal | Fires 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)