Stopping Gui Mouse events from firing?

EDIT: I only want to disable mouse events for the Gui Buttons I specify in the script, not every button.

I’ve tried setting the properties Active and Selectable to false, but whether I did that manually or through a localscript, the event still always fires.

The description of Active suggests that it should be the solution, but it’s not.

Can you explain your problem a bit more? I don’t quite understand what you mean.

So the mouse events get fired when the Gui Buttons are clicked… except I would like to (temporarily) stop that from happening in some point in my script. So the button is visible, but it doesn’t do anything.

Hmm… Instead of that can’t you run a script like this:

if pause == true then
end

I feel like there wouldn’t be a way to disable mouse events due to the fact that it is a core script to roblox, the only way to disable it is to have

if true then

1 Like

Sorry, I just realised that I’ve been saying that I wanted to do this for all Mouse Events when I only wanted to stop Mouse Events from firing for the Gui Buttons I specify.

I’ll change my post to express that better.

I’m still not sure what you exactly mean by stop mouse events but you could always just use if statements or use the Disconnect Method

MouseEvent:Disconnect()

well this could help:

local fire = false

for _,v in pairs(script.Parent:GetChildren()) do
if v:IsA(“TextButton”) and fire ~= false then
–This is if they are allowed to click it.
else
–Not Allowed
end
end

Problem is, I’m using more than one event across 3 scripts for this.
I thought that there might be a property that could be set to false to stop any given Gui Button for firing Mouse Events.

You can add on to it such as adding

if v.Name = “Specificed name” then
end

Other then this, I’m not sure there is a way to stop it.

The active value should do the trick but as you mentioned it isnt.

Maybe try setting Active to true? see if that prevents it?

It still fires the event.
Even if I turn Active off during playtesting (in PlayerGui, not StarterGui).

but what if its set to true? does it work?

i don’t believe there isn’t a specific method for this unfortunately , also the active property doesn’t does disable Gui input

1 Like

Yes, it works. It seems that Active has nothing to do with it, at least for me it doesn’t.

Yes, agreed, roblox has no built in function to disable this, unless you get in pairs and run the function from there.

Ok then.
Thank you both for helping, anyway.

Not a problem, if you have any future enquiries or questions,
Don’t hesitate to create a new post or PM one of our helpful developers.


Have a good day! :smiley:

1 Like