Making a BillboardGui hide if clicked/tapped anywhere not in the BillboardGui

Hello, I am wondering how to hide a Billboard GUI if you click anything that is not in the Billboard GUI

A example here:


I hope that could help in anyway, if this is possible any help will be greatly appreciated!
Thank you, Zonix.

Please send a photo of your Workspace with all of the Billboard components, and I will send a script. :smiley:

1 Like

The billboard is for item selection, so it’s in the playerGui.
I feel confident that I could adapt the code to work with this if sent.
Thank you, Zonix

Well you could put a frame inside the billboard gui and set the Size to {1,0},{1,0}. Then make all of the other gui elements descendants of that frame. Then a script like this. Note: this works for screen guis, but idk if it works for billboard guis.

local frame = --frame inside billboard

local player = game.Players.LocalPlayer
local Mouse = player:GetMouse() --define mouse
 
local hovering = false --variable to check if they are hovering over the frame

frame.MouseEnter:Connect(function() --runs when they move their mouse over the frame
       hovering = true --set variable to true
end) 

frame.MouseLeave:Connect(function() --runs when they move mouse away from the frame
      hovering = false --set variable to false
end)

mouse.Button1Up:Connect(function() --detect when they click
      if hovering == false then  --check if they are not hovering over the frame
            frame.Visible = false --make frame and it's descendants invisible
      end
end)
1 Like