Open/Close Scripting Issue

  1. What do you want to achieve? Keep it simple and clear!
    To know open/close script.

  2. What is the issue? Include screenshots / videos if possible!

The only thing I’m talking about is PanelGUI and Exit

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried Dev Hub and DevFourms but I got lost.

Here is my code block,

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.PanelGUI.Visible = true
end)

and

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.PanelGUI.Visible = false
end)

Note: Exit is Close

So I want to know what I did wrong. I need suggestions or examples.

I’m very confused so where is the exit button?

local panelGui = script.Parent.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	panelGui.Visible = false
end)

Here’s what you’ll need for the exit button to work.

2 Likes

For the open script you need

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.PanelGUI.Visible = true
end)

for the Exit script:

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
end)

Edit: my bad misstype

1 Like

Sorry, it’s my first time creating forums. :pensive:

It’s fine all you had wrong was that you tried to access the panelGUI from script.Parent when the parent of the script was your button.