Alright, you probably know what is going on, but I was making a UIS script until I noticed that when I was typing, the script was activating. How would I disable it? Do you use an event? Do you use a function?
13 Likes
The second parameter to InputBegan is actually meant to help with this problem, usually called ‘gameprocess’, which checks if the input is in a gui object or not.
So if the player is in a gui, typing, gameprocess will be set to true, and if theyre not in a gui, typing, the variable will be set to false- and that’s when you want UserInputService to work.
So do it like this;
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameprocess)
if (not gameprocess) then
-- insert the if blocks here :)
end
end)
Hope this helps,
Lego.
37 Likes
Thanks, I only learned about KeyCode and other stuff about UIS.
1 Like
No problem! There’s lots of cool stuff about UIS to learn about, g’luck.
1 Like
As a suggestion, you don’t need parantheses for your if statement. Instead of this:
if (not gameprocess) then
-- insert the if blocks here :)
end
You can do this:
if not gameprocess then
-- insert the if blocks here :)
end
8 Likes