Making a frame eat up mouse.Button1Down while allowing camera to pan

Basically I want that when users click on the screen where there isn’t a ui button, the current window closes
But I want to let users pan their camera through the default Roblox corescripts
I also don’t want to let the mouse.button1down propagate to all the other connections (e.g: firing a weapon while in a ui window is undesirable)

I am currently using a TextButton but that doesn’t let users pan their cameras
If no better solution is proposed, I will probably check at all the mouse button1down connections if a window is open

Is this a time for ContextActionService? Or is there a very nice modification to the camera corescripts I should do?

2 Likes

you could use mousebutton1click instead of mousebutton1down.
this way the gui closes when the user presses and releases the mousebutton.

also you could havea background frame with each window and checki f the player presses the frame using the InputBegan event of the frame.

1 Like

Your first idea doesn’t satisfy

Your second idea doesn’t satisfy