TextButton
TextButton : GuiButton
Overview
The TextButton
class is a 2D user interface element that displays interactive text. It combines the text-rendering capabilities of a TextLabel
with the interactive features of a GuiButton
, allowing it to respond to user inputs such as clicks or taps. This makes it ideal for creating buttons that perform actions when activated by the player.
Description
The TextButton
class is designed to display text that users can interact with, making it a versatile component for creating interactive elements in a game's UI. It inherits from GuiButton
, which provides the foundational behaviors for interaction, and shares many properties with TextLabel
for text rendering.\
Properties
Text
string
Text determines the content displayed on the button
Code Samples
TextBounds
Vector2
TextBounds is determines the bounds of the text rendered by the UI element, representing the bounding rectangle for displayed text with dimensions indicated by its value.
Code Samples
TextFits
bool
TextFits
is a boolean property that indicates whether the rendered text content within a UI element fits within its allocated space.
Code Samples
TextScaled
bool
TextScaled controls whether text in a UI element is scaled to fill the available space or its parent widget.
This scaling behavior can be determined by the TextScaled property, which allows for dynamic resizing of rendered text to fit within the UI element's space.
Code Samples
Bold
bool
Bold is a boolean property that determines whether the text rendered by the UI element is displayed in bold font style. When set to true
, the text will appear bold, providing enhanced visibility or emphasis within the user interface. If set to false
, the text will maintain its default font weight.
Code Samples
TextSize
number
TextSize determines the font size of the text rendered by the UI element.
Code Samples
TextColor3
Color3
TextColor3 represents a color property for text rendering in the UI element using RGB components.
Code Samples
TextTransparency
number
TextTransparency controls the transparency level of the text rendered by the UI element.
Code Samples
TextWrapped
bool
TextWrapped is a boolean property that determines whether text in a UI element wraps to multiple lines within the GUI element space, potentially truncating excess text.
Code Samples
TextXAlignment
Enum.TextXAlignment
TextXAlignment determines the horizontal alignment of rendered text within a UI element.
Code Samples
TextYAlignment
Enum.TextYAlignment
TextYAlignment determines the vertical alignment of rendered text within a UI element.