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

How to make it not run a script if user is typing (UserInputService) ?

i have a script that if i press a key it makes everything invisible it works but if im typing and i press the key while typing it would work too, how do i stop it when im typing?

this is what im using

game:GetService("UserInputService").InputBegan:connect(function (input)
if input.UserInputType==Enum.UserInputType.Keyboard and input.KeyCode==Enum.KeyCode.X then

--CODE

end
end)

1 answer

✓ Accepted answer

InputBegan gives a second argument which you can use to determine if the user is typing or not:

game:GetService("UserInputService").InputBegan:Connect(function(input,isTyping)
if input.UserInputType==Enum.UserInputType.Keyboard and input.KeyCode==Enum.KeyCode.X and isTyping == false then
--CODE
end
end)

1 comment

0

thank you very much

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