Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

UserInputService Keycode fires when typing. How to fix?

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.

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		print("E")
	end
end)

2 answers

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:

UIS.InputBegan:Connect(function(input, gp)
    if input.KeyCode == Enum.KeyCode.E and not gp then
        print("E")
    end
end)

-Ducky

Developer

Youtuber

Use IsTyping. It will check if they are interacting with UI or not. On your second line put:

if input.KeyCode == Enum.KeyCode.E and not IsTyping then

That should work! Mark as the answer if it did.

This discussion is preserved as it was. New answers, comments, and votes are closed.