Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there any method of detecting key input even with a TextBox focused?

I am currently developing a chat system, but I have run into an issue. By default, KeyDown and KeyUp and other input detection methods are blocked while a user is typing in a textbox. This is a problem because I need to be able to send the chat by pressing the "Enter" key. Anyway, is there any way around this problem? Thanks!

1 answer

very simple, use userinputservice and ignore the game proccessed event.

like this:

local uis = game:GetService("UserInputService")

uis.InputBegan:connect(function(key, gpe)
	if key.KeyCode == Enum.KeyCode.Return then
		print("ok")
	end
end)

3 comments

0

Thanks, I'll try that out!

0

Actually, upon further examination, it turns out that UserInputService still does not detect key presses with the TextBox focused.

0

the script i used works perfectly fine, are you using filteringenabled?

This discussion is preserved as it was. New answers, comments, and votes are closed.