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)
Well since you already know the existence of the GameProcessedEvent, you can use that that see if they are typing with the line :
if GameProcessedEvent then return end
Ex:
game:GetService("UserInputService").InputBegan:connect(function(io,gpe) if gpe then return end if io.KeyCode == Enum.KeyCode.R then print("test (r)") end end)
Addition: what a game processed event really is