TextLabel

TextLabel : GuiObject

Overview

The TextLabelclass is a GUI component used to display non-interactive text within a rectangular frame. It is primarily used for presenting static information, such as titles, descriptions, or labels, in a game's user interface. The TextLabel can be customized extensively in terms of text appearance and layout.

Description

The TextLabel class provides a range of properties and features that allow developers to control how text is displayed within their games. It is ideal for creating visually appealing and informative UI elements without interactive capabilities.

Properties

Text

string

Text determines the content displayed on the Label

Code Samples

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

TextLabel.Text = "Hello"

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

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

print(TextLabel.TextBounds)

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

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

print(TextLabel.TextFits)

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

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

TextLabel.TextScaled = true

Bold

bool

Bold is a boolean property that determines whether the text rendered by the UI element is displayed in bold font style. Use this property to emphasize specific text or create a visually impactful UI element.

Code Samples

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

print(TextLabel.Bold)

TextSize

number

TextSize determines the font size of the text rendered by the UI element.

Code Samples

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

TextLabel.TextSize = 50

TextColor3

Color3

TextColor3 represents a color property for text rendering in the UI element using RGB components.

Code Samples

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

TextLabel.TextColor3 = Color3.new(255, 0, 0)

TextTransparency

number

TextTransparency controls the transparency level of the text rendered by the UI element.

Code Samples

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

TextLabel.TextTransparency = 0.5

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

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

TextLabel.TextWrapped = true

TextXAlignment

Enum.TextXAlignment

TextXAlignment determines the horizontal alignment of rendered text within a UI element.

Code Samples

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

print(TextLabel.TextXAlignment)

TextYAlignment

Enum.TextYAlignment

TextYAlignment determines the vertical alignment of rendered text within a UI element.

Code Samples

local ScreenGui = script.Parent
local TextLabel = ScreenGui.TextLabel

print(TextLabel.TextYAlignment)

Methods

Events