You have to use extra parameters, for example gameProccessedEvent.. This is a true or false parameter. If it is true roblox will think you are interacting with its built in game features. AKA if chatting then it wont print 'yes'...
Here the fixed local script. Make sure to put it in StarterCharacterScript:
01 | local userinput = game:GetService( "UserInputService" ) |
03 | userinput.InputBegan:Connect( function (input, gameProccessedEvent) |
04 | if gameProccessedEvent then |
07 | if input.KeyCode = = Enum.KeyCode.E then |
I've tested it and it works, no errors so there you go!