Making a button close the current frame that is opened

@shieldmr3 Didn’t mean to actually copy the script they’ve provided as an example, They meant for it to teach you how you’re meant to do it, you ahve to change it around depending on what frames you have and what not

Well, It would be best with a for loop but you can also use:

--MouseButtonEvent for Buttons
Frame.Visible = false
Main.VIsible = true
Frame1.Visible = false

BUT, it would be BEST if you didn’t have them in different ScreenGuis
For example:

--hierarchy
-StarterGui
     -ScreenGui
           -Folder1
                 -Frame1
                 -Button1
           -Folder2
                 -Frame2
                 -Button2
           -Folder3
                 -Frame3
                 -Button3

And combine it with the for loop, but you might not like this option so, you can just do the option stated before.

It still underlines the frames

Did you define them?
You have to define them using local frame = (input information here)

It’s because it doesn’t know what the frames are, you didn’t reference anything to tell the code what the frames are. Where is the script located?

In a text button? Ummm…Is that where it goes?

Ok I think I did it…
Screen Shot 2021-02-22 at 2.52.19 PM

I think the first thing you should do is organize the guis a bit to make it a bit more organized and easier to work with. What I would do is have one single Screengui for the side buttons that contains 2 folders, one for the buttons, and one for the frames that need to be changed that have the same name as the textbutton to maek it easier to find which one has to be visible

I will provide you with a clear example right now, I’m working on it!

@EmbatTheHybrid Thank you! thats what I meant by my example. I will provide a clear one now!

Hello, try this:

script.Parent.MouseButton1Click:Connect(function()
    for i, v in pairs(game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"):GetChildren()) do
    if v:IsA("ScreenGui") then
    v:WaitForChild("Frame").Visible = false
    end
    end
end)

Hi,

The problem is I can’t. There is a script in my text button that makes the frame open. It says something like Script.Parent.(Gui name here…).Frame…

I think it would be better if you did it like t his

--ScreenGui
	--FrameFolder
		--The Frames to make visible
	--ButtonFolder
		--The Textbuttons

The script can be editted to suit the hierachy

where does this go and is it local(script)?

Edit: it should be ‘ScreenGui’, not ‘Gui’. Give the script under a button of any Gui in StarterGui.

All that code does is make the frames invisible, there’s nothing there to make a specific frame visible. Again I think it’ sbest if you use the hierachy I made

ok…I will try yours first. I hope this works.

Remember to first organize the stuff before anything code related

So here is a clear one:

Ummm…Everyone? It doesn’t seem like anythings really helping. Maybe if you guys want to tweak my guis I can give you a model. But you can quit while your ahead. If you really want to help me then I would be happy. But its fine if you don’t.