When I click this TextButton, a frame goes away. But the TextButton stays but changes text. I would want to click the TextButton again and then that frame pops up again.
script.Parent.MouseButton1Down:connect(function() script.Parent.Parent.Parent.Frame.Visible = false script.Parent.Text = "<<" end)
we define it as out
local out = true script.Parent.MouseButton1Down:connect(function() if out then out = false script.Parent.Parent.Parent.Frame.Visible = false script.Parent.Text = "<<" else out = true script.Parent.Parent.Parent.Frame.Visible = true script.Parent.Text = "<<" --edit the text to the out position text end)
You need an if
statement. In your case:
script.Parent.MouseButton1Down:connect(function() if script.Parent.Parent.Parent.Frame.Visible == true then script.Parent.Parent.Parent.Frame.Visible = false script.Parent.Text = "<<" else script.Parent.Parent.Parent.Frame.Visible = true script.Parent.Text = ">>" end end)