I created a script that would open/close an Options menu when pressing the "O" key on your keyboard. However, when I tried typing inside a TextBox that the frame "menu" had inside it, it would cut off the menu when I pressed "O". Here's the script:
local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.O then
print("Success!")
local menu = script.Parent.options.menu
local open = menu.isOpen
if open.Value == true then -- Menu is open
menu.Visible = false
open.Value = false
else -- Menu is not open
menu.Visible = true
open.Value = true
end
end
end
end)
The problem is that this script is triggered when "O" is pressed, even when a player is typing in the radio. How do I make this script connect the function when the player is not typing?

1 comment
idk how to use keydown.