Opening a GUI with a key

So I currently have a GUI that opens when a player presses the E key, it’s working fine the only issue is that when a player is typing and uses the letter E it would still open the GUI how could I fix that?

I’m guessing you’re using InputBegan? There’s a 2nd parameter called gameProcessed, it checks if the game internally processed that input, such as when you type in chat or press a GuiButton with your mouse. In those cases, it’ll return true, so what you could do is make a guard clause to prevent your code from running when it is true

local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(input, gameProcessed)
	if gameProcessed then return end --If typing, don't continue
	
	if input.KeyCode == Enum.KeyCode.E then
		--Code
	end
end)