When I press E on my keyboard it fires the function, but when I am typing aswell it also fires it, how do I make it so when I am typing, it wont fire.
1 | UIS.InputBegan:Connect( function (input) |
2 | if input.KeyCode = = Enum.KeyCode.E then |
3 | print ( "E" ) |
4 | end |
5 | end ) |
There are two parameters to InputBegan. The first one is the input, and the second one is if the player is doing something else with that key so do:
1 | UIS.InputBegan:Connect( function (input, gp) |
2 | if input.KeyCode = = Enum.KeyCode.E and not gp then |
3 | print ( "E" ) |
4 | end |
5 | end ) |
-Ducky
Developer
Youtuber
Use IsTyping. It will check if they are interacting with UI or not. On your second line put:
1 | if input.KeyCode = = Enum.KeyCode.E and not IsTyping then |
That should work! Mark as the answer if it did.