Hello guys, I have simple script that when the "F" button is pressed a GUI appears. However, my only problem with is this is that when in-game and using a word that contains the letter it appears. How would I efficiently make it so that it only appears when you aren't typing in the chat?
Here is the script for reference.
local Frame = script.Parent function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.F then Frame.Visible = true end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
The second parameter of the InputBegan event is gameProcessedEvent, as defined in your function. It will be true if you are typing on another gui, etc. Acknowledging this, we can use an if statement to check if the gameProcessedEvent is not true, then do the stuff that you wanted:
local Frame = script.Parent function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.F and not gameProcessedEvent then Frame.Visible = true end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)