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

How to prevent user input service being triggered when a player is chatting?

Let's say that I have a this


local UIS = game:GetService("UserInputService")

function keypress(inputObject, GPE)
    if inputObject.KeyCode == Enum.KeyCode.G then
            -- A bunch of code
    end
end

UIS.InputBegan:connect(keypress)

How do I prevent this being key press whenever a player is using the "g" key to chat?

1 comment

0

Chatting is a GPE....

1 answer

GameProcessedEvent is true while they are typing:

local UIS = game:GetService("UserInputService")

function keypress(inputObject, GPE)
	if not GPE then
		if inputObject.KeyCode == Enum.KeyCode.G then
			-- A bunch of code
		end
	end
end

UIS.InputBegan:connect(keypress)

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