hi, so basically I’m trying to make a starter menu where when you click one option all the other gui’s disappear, but im not sure how i would make it so when 1 gui is clicked the other gui’s can detect that it has been clicked and they disappear as well, if this made sense to anyone could you tell me what sort of thing i need to be doing?
So you mean when a gui button is clicked all of the menu guis disappear?
Simpelest option is just to do Destroy()
You can put a local script inside the gui button with this code:
script.Parent.MouseButton1Click:Connect(function()
x.Frame.Visible=false
end)
where x is the gui you want to hide
Do you have a sample of your script thus far?
Here is some generic code for hiding frames:
local button = script.Parent
local screenGui = button.Parent.Parent
local frame1 = screenGui.frame1
local frame2 = screenGui.frame2
local frame3 = screenGui.frame3
local frame4 = screenGui.frame4
local frame5 = screenGui.frame5
local function hideOtherFrames()
frame1.Visible = false
frame3.Visible = false
frame4.Visible = false
frame5.Visible = false
end
button.MouseButton1Click:Connect(hideOtherFrames)
Also, I attached a sample file so you can see the code in action.
hideFrames.rbxl (41.0 KB)
One thing I would like to add, as others have posted instead of just doing a .Visible = false you could do a Destroy()
In the above code just swap out frame1.Visible with something like:
frame1:Destroy()
Hey!
Instead of asking for help on basic things like this, why not try and learn the basics themselves? I don’t want to come off rude but if you can’t script a menu then I’m not sure if you can script an entire game if you know what I mean.
I’d personally learn the basics by watching Youtube tutorials such as TheDevKing or AlvinBlox, I personally find TheDevKing’s beginner tutorial the best there is on Youtube. If you want some more advice then I’d be happy to give it.
You can add a string value and make a script add the name of every ui you klick in the string value,
Then have scripts on each ui listening for change in the string value, and if the name in the string value ~= to the name of witch the scripts in, visible = false
You get use getchildren and use in pairs/ipairs loop to hide all the children/gui’s under the parent of the instance. I will provide some links you can look at:
Pairs/ipairs: pairs and ipairs | Roblox Creator Documentation
GetChildren(): Instance | Roblox Creator Documentation
In GUI, if you hide the top level frame it automatically hides all of its children.
Ohh, I might have misread this then. I thought they wanted to hide everything to open another piece of GUI, but if this is the case then ya, they can turn visible (or enabled if screen GUI) to false