PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

Focused

The Focused event fires when the /TextBox gains focus - typically when a client clicks/taps on a TextBox to begin text entry. This also fires if a TextBox forces focus on the user.

It can be used alongside TextBox.FocusLost to track when a TextBox gains and loses focus.

See also the /UserInputService/TextBoxFocused and /UserInputService/TextBoxFocusReleased for similar functions that rely on the UserInputService service.

This event will only fire when used in a /LocalScript.


Code Samples


Focus

This example works when placed in a /LocalScript that is the child of a TextBox. When the TextBox gains focus, the example prints “Focus”.