Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make that when Im typing in chat, it wouldn't print "yes" When I click E?

Asked by
JoneXI 51
4 years ago

Whenever Im Typing in chat and clicking E it prints "yes", how do I make this not happen?

Script:

1local userinput = game:GetService("UserInputService")
2 
3userinput.InputBegan:Connect(function(input)
4    if input.KeyCode == Enum.KeyCode.E then
5        print("yes")
6    end
7end)

Thank you.

1 answer

Log in to vote
2
Answered by 4 years ago

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:

01local userinput = game:GetService("UserInputService")
02 
03userinput.InputBegan:Connect(function(input, gameProccessedEvent)
04    if gameProccessedEvent then
05        return
06    end
07    if input.KeyCode == Enum.KeyCode.E then
08        print("yes")
09    end
10end)

I've tested it and it works, no errors so there you go!

0
Thank you JoneXI 51 — 4y
0
Np glad I could help JeffTheEpicRobloxian 258 — 4y
Ad

Answer this question