I have a script that runs an event when the letter R is pressed. The only problem is, it also runs when the player is typing and press R. Is there anyway to fix this?
This is the script:
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.R then
print("test (r)")
end
end)

2 comments
I'd like to explain what the gameProcessedEvent is. It's a boolean that is true if the input is being processed elsewhere by the game. This can be in a custom TextBox, and even, chatting.
sharksie described it as such : "GameProcessedEvent tells you if roblox processed the event before it told you about it. A is the jump button, R2 is the click button, and R1/L1 are the tool switch buttons. You can tell roblox to stop processing the A button by unbinding the control from ContextActionService (you can find the control in the StarterCharacterScripts). You can stop roblox from proces"