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

how to disable userinputservice while chatting?

what if i set e to open a gui and if i'm chatting and i type in "YES" that would still open the gui right so how would i disable it while chatting

2 answers

✓ Accepted answer

Hello, lemme tell you how to fix this, and explain it, so the second argument in the event of InputBegan is gameProcessedEvent, which is true when the player is chatting, so to stop the event from firing when chatting, you can just try and use an if statement and then returning nothing, which stops the event, like so:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input,gameProcessedEvent)
	if gameProcessedEvent then return end -- This stops it from firing when you are chatting
	if input.KeyCode == Enum.KeyCode.A then
		-- Your code here
	end
end)

1 comment

0

nice thanks man

hello

game:GetService("UserInputService").InputBegan:Connect(function(input,chat)
	if not chat then
		if input.KeyCode == Enum.KeyCode.T then
			print('damn')
		end
	end
end)

or

game:GetService("UserInputService").InputBegan:Connect(function(input,chat)
	if not chat then return end
	if input.KeyCode == Enum.KeyCode.T then
		print('damn')
	end
end)

2 comments

0

maybe you should explain and what is "i.KeyCode"

0

woops sry lol, i forgot

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