Gui won't show when clicking

  1. What do you want to achieve? Keep it simple and clear!
    Make a gui appear when you click a icon (not a text label)
  2. What is the issue? Include screenshots / videos if possible!
    The gui won’t show
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried removing the ) at the end and also tried to connect the function but that didn’t work since if remember correctly, that’s used for click detectors or either I did it wrong.

Script:

script.Parent.MouseButton1Click:connect(function()
	if script.Parent.Parent.Box.Visible = false 	
	then script.Parent.Parent.Box.Visible = true
	else
		script.Parent.Parent.Box.Visible = false 
	end 
end)

Also if you need a video of this I can send one.

Please include all of the code, since you currently lack a method that detects when a button is pressed. Also include a screenshot of how your UI is setup, and where your script is in said UI.

376802381cc1cbf3986bb735b3a46938

I also fixed the error in my post which made the function not appear

script.Parent.MouseButton1Click is an event which fires when a GuiObject is clicked.

script.Parent.MouseButton1Click:connect(function()
	if script.Parent.Box.Visible == false 	
		then script.Parent.Box.Visible = true
	else
		script.Parent.Box.Visible = false 
	end 
end)

You were missing a double “==” for is equal to, in the conditional statement.
Also that script will need to be a local script not a server script like your screenshot shows. Oh, and I’ve fixed the references to the correct “Box” instance that you’re trying to fetch.

1 Like

When OP originally posted they did not have this in their code which is why I asked for more code. Based on what OP said in their post I was under the assumption they had not included any events to detect when a GuiObject is clicked. Rather than assuming this I asked for additional code before attempting to debug it. I also asked for a screenshot to properly debug the setup of their explorer tree, which as we can see was necessary.

You can see this because OP says: