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

How do i make it so UIS doesn't work when you're typing?

When typing say i say in chat "few" or something anything with an f it will now print hi how would i make it so it doesn't work when typing?

local UIS = game:GetService('UserInputService')

UIS.InputBegan:connect(function(input)
	if input.KeyCode == Enum.KeyCode.F then
		print("hi")
	end
end)

1 answer

✓ Accepted answer

Hi ATestAccount420,

All you need to do for this is check if it's not gp, which I always set for the second argument. UserInputService has 2 parameters, the input and the game processed event.

##Here, this is how you would do it:

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

uis.InputBegan:Connect(function(key, gp)
	if key.KeyCode == Enum.KeyCode.Q and not gp then -- Here, you can see that I checked if it's not gp, meaning to check if it's not a game processed event.
		print("Worked.");
	end
end)

##You can read up more on this here.

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

Thanks,

Best regards,

~~ KingLoneCat

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