Hi guys, I’m trying to create a simple phone, and I want to script a button that opens and closes multiple frames at the same time. I’ve read many posts and solutions but they did not work for me.
These are my frames that is held in the container.
Please help / offer advice on how I could achieve this result. Thank you!
Loop through all the children of the container and set its viability to true
Ideally you’d want to name each frame it’s own separate thing. After the fact you may write a module script that takes a parameter toShow, or something similar. The module script should contain a function that loops through all the named frames and with a simple true or false expression, where true is returned if the given frame matches toShow, hide or show the given frame.
1 Like
for _, frame in (MainContainer Path):GetChildren() do
if frame.ClassName ~= "Frame" then continue end
Frame.Visible = true
end
1 Like
examplescript = {}
function examplescript.Looper(toShow, callerParent)
for _, frame in callerParent:GetChildren() do
if frame.Name == toShow then
print('this is the one')
else
frame.Visible = false
end
end
end
return examplescript
basic example i wrote up while doing duolingo lessons, please make sure it functions properly before copying
1 Like
With the way that naming was done… it made me not want to reply to this OP. After seeing how you wrote that. I got to say I like the creativity for handling this situation.
1 Like