PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
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”.

local TextBox = script.Parent

TextBox.Focused:Connect(function()
	print("Focused")
end)