How to avoid CaptureFocus to send the previous trigger key to the Textbox?

I want to send the focus to a TextBox when I press Q.
For that, I used the sample here:
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
		wait() -- necessary for the line below to take effect
		textBox.Text = '' -- clear the previous typed 'q'
1 Like