Mouse.KeyInUse (15 chars yo)

Not sure if it’d go under Mouse in particular but…

Returns true is the keyboard is inputting into a TextBox or the Chat.

UserInputService.InputBegan/Ended/Changed pass a second parameter called “gameProcessedEvent”. It’ll be true if the key was typed into a textbox. You can also use UIS.TextboxFocused and UIS.TextboxFocusReleased to manually keep track of textboxes being focused if the gameProcessedEvent doesn’t work for you.

I know there are ugly workaround.

I don’t think this would require much effort at all for them, but would save the devs a little bit of time.

It’s not a workaround? You’re trying to use Mouse for non-mouse input – that’s what UIS is for. The only reason Mouse has KeyDown stuff is because there was no UIS a while back, and KeyDown/KeyUp are deprecated now.

Suggestion for a title that actually fits the 15 characters requirement:

Feature to detect if keyboard is in use by TextBoxes/Chat

3 Likes

Returns: TextBox
Description: Returns the currently selected textbox, or nil if none is selected.

They’ve since added this so we don’t need to keep track of TextboxFocused/TextboxFocusReleased

4 Likes

Oh that’s awesome. Does it work on chat as well?

Yep
blob.png

I had to upload a test script to an online server though.

uis = game:GetService'UserInputService'
while true do
	local textbox = uis:GetFocusedTextBox()
	print(textbox)
	wait(.3)
end

I couldn’t test chat while in start server/player mode in studio. Did they remove that? I was just using it a couple weeks ago.

1 Like

I couldn’t test chat while in start server/player mode in studio. Did they remove that? I was just using it a couple weeks ago.

You have to open from / upload it to the website to test the chat.

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