We use cookies on this site to enhance your user experience

A GUI object which allows you to type within its boundaries.

TextBox is specifically meant for user input.

Unlike TextLabel, TextBoxes will not be translated by LocalizationService because it’s text is assumed to be user input. For a text field that is not meant for user input TextLabel should be used.


Properties

Name Type Description
bool

Determines whether clicking on the TextBox will clear its TextBox/Text property

Font

Determines the font used to render text.

float

Scales the spacing between lines of text in the TextBox.

bool

When set to true, text inside a TextBox is able to move onto multiple lines. This also enables players to use the enter key to move onto a new line.

Color3

Sets the text color that gets used when no text has been entered into the TextBox yet.

string

Sets the text that gets displayed when no text has been entered into the TextBox yet.

bool

If set to true, input native to the platform is used instead of Roblox’s built-in keyboard.

string

Determines the string rendered by the UI element.

Vector2

The pixel size of a UI element’s text.

Color3

Determines the color of rendered text.

bool

Whether the text fits within the constraints of the TextBox.

bool

Changes whether text is resized to fit the GUI object that renders it.

float

Determine the line height of text in pixels.

Color3

Determines the color of the text stroke (outline).

float

Determines the transparency of the text stroke (outline).

float

Determines the transparency of rendered text.

TextTruncate

Controls the truncation of the text displayed in this TextBox.

bool

Determines if text wraps to multiple lines within the UI element space, truncating excess text.

TextXAlignment

Determines the horizontal alignment of rendered text.

TextYAlignment

Determines the vertical alignment of rendered text.

Inherited from Instance , GuiBase , GuiBase2d , GuiObject

Archivable ClassName DataCost Name Parent RobloxLocked AbsolutePosition AbsoluteRotation AbsoluteSize AutoLocalize RootLocalizationTable Active AnchorPoint BackgroundColor3 BackgroundTransparency BorderColor3 BorderSizePixel ClipsDescendants LayoutOrder NextSelectionDown NextSelectionLeft NextSelectionRight NextSelectionUp Position Rotation Selectable SelectionImageObject Size SizeConstraint Transparency Visible ZIndex

Functions

Name Type Description
void

Forces the client to focus on the TextBox.

bool

Returns true if the textbox is focused, or false if it is not.

void

Forces the client to unfocus the TextBox.

The submitted parameter allows you to over-ride the enterPressed parameter in the FocusLost event.

Notes

  • This item should be used with a `LocalScript` in order to work as expected in online mode.

Example

The code shown below will force the client to unfocus the 'TextBox' 5 seconds after it's selected:

local TextBox = script.Parent
TextBox.Focused:connect(function()
	wait(5)
	TextBox:ReleaseFocus()
end)

Please be aware that the above example assumes that it's in a LocalScript, as a child of a TextBox.


Inherited from Instance , GuiBase , GuiBase2d , GuiObject

ClearAllChildren Clone Destroy FindFirstAncestor FindFirstAncestorOfClass FindFirstAncestorWhichIsA FindFirstChild FindFirstChildOfClass FindFirstChildWhichIsA GetChildren GetDebugId GetDescendants GetFullName GetPropertyChangedSignal IsA IsAncestorOf IsDescendantOf WaitForChild TweenPosition TweenSize TweenSizeAndPosition