How do you check if a player is typing in a TextBox? I have certain keys bind to open menus in my game and this is an issue for when I need the player typing in a TextBox.
EDIT; This is what I currently have, but it doesn't work...
userInput = game:GetService("UserInputService") focused = false userInput.TextBoxFoxused:connect(function()--fires when the player focuses on a textBox focused = true print("We live!") end) userInput.TextBoxFoxusedReleased:connect(function()--fires when the player unfocuses from a textBox focused = false print("We off") end) userInput.InputBegan:connect(function(input) print("Hi!") if input.UserInputType == Enum.UserInputType.Keyboard and input.UserInputState == Enum.UserInputState.Begin and input.KeyCode == Enum.KeyCode.M and focused == false then onClicked() end end) script.Parent.MouseButton1Click:connect(onClicked)
With this!
uis = game:GetService("UserInputService") focused = false uis.TextBoxFocused:connect(function()--fires when the player focuses on a textBox focused = true end) uis.TextBoxFocusReleased:connect(function()--fires when the player unfocuses from a textBox focused = false end)
Then just add an if not focused then do all the stuff with the keys pressed.