I've spent the past 3 hours trying to figure this seemingly simple thing out and I'm about to rip my hair out. So all I want is to be able to click on this TextButton, and have it make the other TextButtons visible upon clicking if they're currently not visible, or make them invisible if they're currently visible. Here's my code:
Button = script.Parent Button1 = Button.TextButton1 Button2 = Button.TextButton2 Button3 = Button.TextButton3 Button4 = Button.TextButton4 function clicked() if Button.Value == false then Button1.Visible = true Button2.Visible = true Button3.Visible = true Button4.Visible = true Button.Value = true elseif Button.Value == true then Button1.Visible = false Button2.Visible = false Button3.Visible = false Button4.Visible = false Button.Value = false end end script.Parent.MouseButton1Click:connect(clicked)
Value is just a Boolean value I have that is a child of the text button that is supposed to be clicked so I don't have to type up code that checks if each individual button is visible or not. The script's Parent is the button that is getting clicked. The other button's are children of this button, and start off not visible. I know there are simpler ways to write this but none of the way I tried work and this was just my latest attempt at a work around that didn't work. Nothing is going wrong in the script according to output. I've only tested it in studio using the "Play Here" button, not in an actual server. Help me please.
Hey pepsirune101112,
If you set the parent of all the textButtons to Visible = false all of the children become invisible as well
Button = script.Parent Button1 = Button.TextButton1 Button2 = Button.TextButton2 Button3 = Button.TextButton3 Button4 = Button.TextButton4 function clicked() if Button1.Visible == false then -- if it is invisible make it visible Button1.Visible = true Button2.Visible = true Button3.Visible = true Button4.Visible = true else -- if it is already visible then make it invisible Button1.Visible = false Button2.Visible = false Button3.Visible = false Button4.Visible = false end end script.Parent.MouseButton1Click:connect(clicked)