Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with gui popping up?

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)

2 answers

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.