About TextBoxes

I have a question about TextBoxes. Can you “activate” them manually through a localscript? I mean you can hover over them and click to activate them but I want to do this by script. Is there any way?

Are you looking for the .TextEditable property?

If you are, you should also make sure that .ClearTextOnFocus property is disabled to prevent the text from being erased after being clicked on, as recommended from the Docs itself.

Give it a try and notify me if it’s what you’re looking for!

Thanks for your reply! What I meant is that if you have a normal textbox in roblox (clear text on focus is off) you can click the box or text and edit its content. However, I want the user to be able to edit the textbox content without needing to click on the textbox. So the user can play the game normally (walk, jump, …) and when they press a button a textbox appears and they are automatically writing in it (changing the content). So when they press the button to make the textbox appear they dont have to click on the textbox before editing the content, they can just start to type something in their keyboard and it will show up in the textbox.

Read the documentation:
TextBox | Documentation - Roblox Creator Hub

In short use TextBox:CaptureFocus().

1 Like

Oh, my bad. I believe you’re looking for the :CaptureFocus(). Docs includes a code sample that runs a very simple script to make the the Player focus on a text box whenever a key is pressed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.