Multi-Functioning Open and Close GUI System

I am confused, because the first line:

if buttons:IsA(“TextButton”) and buttons ~= textbutton then

Worked for 2 of the 3 buttons…So what would I add so it would then work for the third button

My 3rd button (that isnt showing up) is called PrevButton

Your other button is a TextButton, hence it is getting caught up in the for loop. Reference your other Button in the script and then blacklist it in the for loop.

if buttons:IsA("TextButton") and buttons ~= textbutton and buttons ~= 'PrevButton' then

This is what the script looks like right now-and same issue with the one button

textbutton.MouseButton1Click:Connect(function()
	for _, buttons in pairs(gui:GetChildren()) do
		if buttons:IsA("TextButton") and buttons ~= textbutton and buttons ~= 'PrevButton' then
			if open.Value == true then
				buttons.Visible = true
				frame.Visible = true
				open.Value = false
				close.Value = true
				textbutton.Text = "Close Dances" -- Change to what you want to say.
			elseif close.Value == true then
				buttons.Visible = false
				frame.Visible = false
				open.Value = true
				close.Value = false
				textbutton.Text = "Dances" -- Change to what you want to say.
			end
		end
	end
end)

lol, I should’ve clarified before.

local Button2 = ... --- location to 2nd button
if buttons:IsA("TextButton") and buttons ~= textbutton and buttons ~= Button2 then   
--- code

this did not work

local PrevButton = script.Parent.Parent.PrevButton

textbutton.MouseButton1Click:Connect(function()
	for _, buttons in pairs(gui:GetChildren()) do
		if buttons:IsA("TextButton") and buttons ~= textbutton and buttons ~= 'PrevButton' then
			if open.Value == true then
				buttons.Visible = true
				frame.Visible = true
				open.Value = false
				close.Value = true
				textbutton.Text = "Close Dances" -- Change to what you want to say.
			elseif close.Value == true then
				buttons.Visible = false
				frame.Visible = false
				open.Value = true
				close.Value = false
				textbutton.Text = "Dances" -- Change to what you want to say.
			end
		end
	end
end)

Try adding a coroutine while do loop like this:

coroutine.resume(coroutine.create(function()
    game:GetService("RunService").RenderStepped:Connect(function()
        PrevButton.Visible = frame.Visible
    end)
end)

Make sure the coroutine while do loop is above the event.
Edit: I meant a renderstepped event not a while do loop, sorry for the mistake :smile:

Im confused how this would fit though.

thats very weird why it does that