If I press the button the frame that is already visible will become invisible and the other frame will become visible. How can I achieve that?
Something like this may work
local Frame1 = ...
local Frame2 = ... -- Set these 3 things
local Button = ...
local State = false
Button.Activated:Connect(function()
State = not State
Frame1.Visible = State
Frame2.Visible = not State
end)
What if I made more?
Could you help me make it like a loop?
Is it meant to cycle through the frames with each press, or is there 2 āgroupsā of frames, which it will alternate between
I meant all the frames inside a folder. So for example i have 50 frames there and i press one. I want it to check if any of the frames are visible and make them invisible. Then make the other frame visible.
What would the āother frameā be though?
The button that would make the frame vidible for example button 1 would open a frame while closing the other frames
are you possibly referring to this example Iāll give:
For example:
local button1 = -- Button1
local button2 = -- Button2
local Frame1 = -- Frame Here
local Frame2 = -- Frame2 Here
Where in if button1 is pressed, Frame1 will be revealed, and if button2 was pressed, Frame2 will be revealed.
And whenever Frame2 is still open and you Pressed button1, it will Hide Frame2 and Reveal Frame1, vice versa. Is that it?
Yes like that thats what i want
its simple, you can get @SeargentAUS 's example, and youād just have to duplicate the
Button1.Activated:Connect(function()
-- code here
end)
Button2.Activated:Connect(function()
-- code here
end)
And you would place the necessary coding there. Of course, you would use Bool Values to make it happen since, it could get pretty glitchy if you didnāt.
Basically I think the most future-proof per se, would be to loop through all the buttons:
for _, button in pairs(buttons) do
if button:IsA(āTextButtonā) then
button.Activated:Connect(function()
for _, frame in pairs(frames) do
if frame.Visible == true then
frame.Visible = false
end
end
frame.Visible = true
end)
end
end
Sorry for the formatting, Iām typing this on mobile.