Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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

Ad

Answer this question