How can I make a button that can open a frame in a different ScreenGui

Hello! How can I make a script when you press a button, it can open a frame inside a different ScreenGui


The Circle is the button you will press, and the arrow is the frame it would open. How can I do this? I also want the script to do this, you can open it, but you can press it again to close it. (No transition needed)

Any help will be appreciated :slight_smile:
(Also sorry if it’s terribly written I am on my phone, if you need any more clarification just ask and I will answer asap)

do you also need to disable other frames when you open one? if yes, which frames?

Nah, no frames need to be disabled when you open that frame. I had a open frame, but I just don’t know how to make it open a frame inside another ScreenGui.

Here is my old Script that I am using currently:

script.Parent.MouseButton1Click:Connect(function()
    
    for _, v in pairs (script.Parent.Parent.Parent.Parent:GetChildren()) do
        if v:IsA("Frame") then
            for _, nV in pairs(v:GetChildren()) do
                if nV:IsA("TextButton") then
                    for _, v2 in pairs(nV:GetChildren()) do
                        if v2:IsA("Frame") then
                            if v2 == script.Parent.Parent.Frame then
                                v2.Visible = not v2.Visible
                            else
                                v2.Visible = false
                            end
                        end
                    end
                end
            end
        end
    end

end)

oh, so the toggle button and the gui you want to open is in a different gui?

So basically what I want is when you press the ImageButton, it opens the Frame inside “ExclusiveCodes”. But also when you open it, you can click on the button once again to close it as well.

(You can ignore this but I am just explaining my old script. My old script the frame was inside the same textlabel so is just opened that frame inside that TextLabel. But if you know for my old script, how you could make it open the frame inside the other ScreenGui, that could also work)

do you want the script inside this? or in a completely different one

Actually I gotta go, it’s getting late, I will reply back tomorrow.

oh okay.

This text will be hidden

why can’t you just reference the frame inside the script then make that gui enabled or make that frame visible?

How am I supposed to do that? What do I change in the script to parent to the Frame inside the other screen gui

1 Like

liek just make two buttons, open, and close. when you click open, open turns off and becomes invisible, and close comes up. and also script.Parent.Parent.Parent.Parent.ExclusiveCodes.Frame.Visible = true. then do the opposite when click close button.

You can try to put a local script in the startergui, not in the gui, also when the game starts the screen guis go to the player so you can try something like local outgui = game.Players.LocalPlayer.PlayerGui:WaitForChild("gui").frame.