UserInputService.InputBegan fires when player is typing

I have a keybind set on E using this example block of code:
image

The problem is that when a player types the letter E they will unintentionally trigger this function. Is there any way to fix this? Any other way around it?

I thought about using ‘Mouse.KeyDown’ instead of UserInputService but the wiki says it’s deprecated.

1 Like
game:GetService("UserInputService").InputBegan:Connect(function(input, proccessed)
    if input.KeyCode == Enum.KeyCode.E and not proccessed then
        print("pressed")
    end
end)
10 Likes

Tested and works. Thanks!

2 Likes