I have an open/close script that works for one frame. How can I alter the script so that the open/close function works for two frames simultaneously? (both frames are children of my screengui)
My script below is the one I am using right now, which only opens the one frame.
local frame = script.Parent.Parent.Pages -- Replace "TESTFRAME" with your frame name.
local textbutton = script.Parent.Parent["Dances Button"] -- Replace "OPENCLOSETESTFRAME" with your TextButton name.
local open = script.Open
local close = script.Close
open.Value = true
textbutton.MouseButton1Click:Connect(function()
if open.Value == true then
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
frame.Visible = false
open.Value = true
close.Value = false
textbutton.Text = "Dances" -- Change to what you want to say.
end
end)
if open.Value == true then
textbutton.Text = "Close Dances"
else
textbutton.Text = "Dances"
end
frame.Visible = not frame.Visible
open.Value = not open.Visible
close.Value = not close.Visible