Using Folders in ScreenGUI's

Is it alright that I’m using a folder inside of a ScreenGUI? It’s used to organize a bunch of textlabels that will be randomly chosen with math.random, (I’m planning to add more textlabels) and when I reference it inside of a localscript the output doesn’t seem to recognize it as being there.


This is what I have done so far in the code, to which there’s apparently a problem in the output with line 5 (the folder one).

local plr = game.Players.LocalPlayer
local answer = game.Workspace:WaitForChild("answer")
local scrollgui = plr:WaitForChild("PlayerGui").ScrollGui
local scroll = scrollgui.ImageLabel
local texts = scroll:WaitForChild("Folder")
local button = scrollgui.ImageButton

3 Likes

Based on the screenshot, the Folder is placed directly into the ScrollGui but line #5 is looking for the Folder inside of “scroll”, which was defined as the ImageLabel.

If you update the “texts” variable to reference “scrollgui” instead of “scroll”, it’ll be looking in the correct spot and it should find it:

-- Before
local texts = scroll:WaitForChild("Folder")

-- After
local texts = scrollgui:WaitForChild("Folder")
2 Likes

I personally don’t recommend using Folders within your UI since it doesn’t respect the modifiers you have in your UI, now in your case it doesn’t seem like your using any ListLayouts or AspectRatios or anything of that so It won’t affect you as much but that’s just my own little pet peeve.

2 Likes

oh my bad lol, I didn’t realize. Thanks for pointing it out, it made it work

1 Like