The TextBoxFocused event fires when a gains focus on a
TextBox - typically when a client clicks/taps on a text box to begin inputting text. This also fires if a text box focus is focused using
For example, the code below prints the the name of the TextBox focused when the event fires.
local UserInputService = game:GetService("UserInputService") function TextBoxFocused(textbox) print(textbox.Name) end) UserInputService.TextBoxFocused:Connect(TextBoxFocused)
It can be used alongside
UserInputService/FocusReleased to track when a text box gains and loses focus.
As this event only fires locally, it can only be used in a
Modifying a TextBox on Focused and FocusReleased
This example adjusts the
TextBox|TextBoxes when they gain and lose focus using.
When a text box
UserInputService/TextBoxFocused|gains focus, it’s transparency deceases. When a text box
UserInputService/TextBoxFocusReleased|loses focus, it’s transparency increases. This is similar to how the default chat window increases and decreases transparency when a user starts and stops interacting with it.
In order for this example to work as expected, it should be placed in a