Hey, so rather than writing out all of my UI variables like this for example:
local frame1 = gui:WaitForChild("F1")
local button1 = frame1:WaitForChild("B1")
I came up with a wonderful workaround to this. What I do, is I create a recursive function that iterates over the UI, and for each element it finds it’ll recurse that element, and add everything to a table. So when ever I want to access a UI element specifically, I can simply just do the following:
ui = {}
ui.some_frame.Visible = false
Here’s what I’m a bit concerned about though, if when I run this recursion, what if some elements in the UI for that player did not load in? So when I try to access it, it might return nil
. And it doesn’t seem super efficient for me to put like a 3 second yield at the top of my script, so I’m trying to find the best possible way I can make sure all the elements in the user interface has loaded in before I begin this recursion. Thanks!