I'm making a shop script where if you click on a mannequin it would return a card UI made from a billboard GUI that would show information on the clothing. Instead of making an X button to close the card, I want anywhere outside of the card to be able to close it. Because it is a BillboardGUI i cannot place a big invisible text button across the screen to cause this, unless its possible to put a billboardGUI over a screenGUI. What should I do?
✓ ANSWER ACCEPTED
How do I make anywhere outside of the GUI the exit button?
1 answer
✓ Accepted answer
One way to do it could be to get the mouse and call the Button1Down event and once the player clicks somewhere that isn't a GUI then it will fire, then you can call the code you want.
I'm not going to write the full code for you, but here is a general example of what I mean.
repeat wait() until game.Players.LocalPlayer
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local frame = script.Parent.Parent.Frame -- your frame goes here
mouse.Button1Down:Connect(function()
if frame.Visible == true then
frame.Visible = false
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
thanks, this helps a lot
add in: "if frame.Visible == true then frame.Visible = false else frame.Visible == true end" and then it can work for an on and off switch.