Add Close GUI Button

How can i add a button to close the GUI. I tried but i can’t work it out Thanks
Screenshot_1|228x122

We have progressed to downloading JPG images LOL

For the people that can’t see it:
image

Just add a LocalScript inside the Button that you want the GUI to close from, and insert this:

local Button = script.Parent
local GUI = Button.Parent.Parent.Parent

Button.MouseButton1Down:Connect(function()
    if GUI.Enabled == true then
        GUI.Enabled = false
    else
        GUI.Enabled = true
    end
end)
1 Like

It’s pretty simple to do, not sure if this works.

local button = script.Parent
local gui = button:FindFirstAncestorWhichIsA('ScreenGui')

button.MouseButton1Down:Connect(function()
    gui.Enabled = not gui.Enabled
end)
1 Like

Thanks dude! It works. I had to modify another script but it works perfectly