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

Clicking keys while chat bar is open activates my script?

Asked by 6 years ago

How do I make it so that while a player is chatting in the game chat, it won't activate a script that involves a key press?

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

Hi Wolf,

UserInputService comes with two parameters. The first one is the UserInput object, and the second is the game processed event. Just check that game processed event isn't true.

Like this:

local uis = game:GetService("UserInputService");

uis.InputBegan:Connect(function(obj, gp)
    if obj.KeyCode == Enum.KeyCode.Q and not gp then -- The 'not gp' part makes sure that it wasn't a game processed event, as in it wasn't clicked while typing.
        -- Whatever
    end
end)

Well, I hope I helped and have a wonderful day/night.

Thanks,

Best regards,

~~ KingLoneCat

0
Yo lone cat teach me how to make text big BlackOrange3343 2676 — 6y
0
What do u mean? KingLoneCat 2642 — 6y
Ad

Answer this question