How do I make User Input Service not work when I click on a button in the GUI? Because if I click the GUI button it will still take in Enum.UserInputType.MouseButton1.
✓ ANSWER ACCEPTED
Make UIS not work when I interact with GUI?
1 answer
✓ Accepted answer
There is no way to disable User Input entirely, as then you would not be able to do anything to the client. You can, however, make a variable that if you click a button your code is no longer ran.
local disabled = false
local button = script.Parent
button.MouseButton1Click:connect(function()
if disabled then
disabled = false
elseif not disabled then
disabled = true
end
end)
game:GetService("UserInputService").InputBegan:connect(function()
if not disabled then
--code
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Another method is to check if the Mouse is within the bounds of a GUI object when it is clicked. It's a little bit more dificult to implement, but then all the logic is in one place.