Check if F9 console is open?

I’ll get to the point: I have a custom chat that takes focus when the player presses the “/” key, or takes focus and auto-types a command prefix if the player presses the “.” key. The problem is, that interferes with the F9 console. If I’m typing out a command in the console, I have to click on the command line again every time I press “.” (as the chat takes focus away from it) - is there a way to check if the F9 console is open?

1 Like

Check if the console is opened: Documentation - Roblox Creator Hub under “DeveloperConsoleVisible”

You can also toggle the visibility: Documentation - Roblox Creator Hub under “DeveloperConsoleVisible”

1 Like

Aha, thanks! It’s a bit odd that there’s no event for it (I tested GuiService.MenuOpened/MenuClosed, but that’s only for the esc menu), but it’s better than nothing.

Yeah. It’s better than nothing though. Although, events are useful.

I recommend changing this to use GetFocusedTextBox, so that this will work with any other textbox, not just the Developer Console.

1 Like

Are you using UserInputService or ContextActionService to hook to your chat?

Using UserInputService, as there’s no way I’m porting this game to mobile.

You should use ContextActionService anyway. Unless you’re specifically trying to get input while a textbox is focused, it’ll serve your needs more flexibly, and you can also debug it using the Action Bindings tab in the dev console.

If you are trying to get key press events while a textbox is focused, you should use the textbox’s InputBegan and InputEnded events.

When I used UIS I found that it didn’t care if a text box was focused when the key was pushed. CAS didn’t run the function of you were just typing in a text box.