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

How to tell if a player is chatting with UserInputService?

The script works fine, I just dont know how to keep it from opening when you press e while chatting.

uis.InputBegan:Connect(function(key)
	if key.KeyCode == Enum.KeyCode.E then
	if gui.Enabled == false then
	gui.Enabled = true
else
	gui.Enabled = false
		end
	end
end)

1 answer

InputBegan, along with InputEnded, returns another value that can be used to tell when the player is chatting or doing another task with things such as the menu or chatting.

This value is called gameProcessedEvent Indicates whether the game engine internally observed this input and acted on it. Generally this refers to UI processing, so if a button was touched or clicked from this input, gameProcessedEvent would be true. This is also true for input events connected via ContextActionService

uis.InputBegan:Connect(function(key,g)
    if g then return end

    if key.KeyCode == Enum.KeyCode.E then
    if gui.Enabled == false then
    gui.Enabled = true
else
    gui.Enabled = false
        end
    end
end)

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