I want to send the focus to a TextBox when I press Q.
For that, I used the sample here:
https://developer.roblox.com/en-us/api-reference/function/TextBox/CaptureFocus
However, when I press Q, this key is already sent to the Textbox:
How to avoid this?
1 Like
For this to work, I have to add two lines after the CaptureFocus
:
if actionName == ACTION_NAME and inputState == Enum.UserInputState.Begin then
textBox:CaptureFocus()
wait() -- necessary for the line below to take effect
textBox.Text = '' -- clear the previous typed 'q'
end
1 Like