Using Folders in StarterGui

[SOLVED]


Hey there!

Over the past few months, I have been seeing few projects and guides on social media that while they teach how to make a system for GUIs, they use Folders.

It was my first time seeing this and working fine. I decided to take some research on the forum to see if anyone has to say if it is profitable and it is a good strategy, but I incredibly couldn’t, except for someone in the same reaction as I surprised:

Although not being efficient, I decided to create this topic to know if any reader knows if it is a good idea to store folders in StarterGui, if it is profitable, and specially how it can affect in scripting.

Thank you!

2 Likes

Here are examples of someone using Folders in StarterGui:


Source: ScreenGuis in StarterGui folder resets on respawn

Folders are incredibly useful when it comes to GUI. I have a very GUI-orientated game and it can get confusing if things aren’t in folders.

1 Like

It isn’t a good idea to put your ScreenGuis in folders because they aren’t meant to go inside of folders, which is especially true when you factor in the unexpected behaviour of your ScreenGuis resetting on respawn. If you need the organization factor that folders offer, and you don’t want your GUIs to reset, you need to nest your ScreenGuis inside of other LayerCollectors. You can, however, put your UI elements inside of folders inside of the ScreenGui. It is just that folders should not be the topmost instance inside of a PlayerGui.

1 Like

Okay… Now this got me confused… @XXXTMS says it is useful whenever it comes to organizing your GUIs in StarterGui and you contradicting stating that they aren’t meant to be stored in folders… I am totally confused now. :grimacing:

There is obviously difference in opinion but it’s really up to you to gauge whether the pros are worth it or not.

Some factors to acknowledge:

  • Folders have less properties and thus should take less memory than entire ScreenGuis (usually negligible but it is a memory difference nonetheless)
  • ScreenGuis inside of folders will reset on spawn regardless of their ResetOnSpawn property as mentioned above
  • You can get expected behaviour if you put your UI elements (frames, ImageLabels etc) inside of folders which are inside of your ScreenGui
  • There is still the option of parenting LayerCollectors to other LayerCollectors for categorization in place of folders to get the behaviour of respecting ResetOnSpawn.
1 Like

Understandable, Cody!

According to the factors you have mention, if I were to use LayerCollector that contains Folders (or the contrary) with ScreenGui inside, would that take less memory and would be a optimization for a Roblox project?

Furthermore, it is my first time hearing about the LayerCollector | Documentation - Roblox Creator Hub… I have never heard of it in the Documentation or in simple guides that exist around the media. So, I might be asking something pretty odd here :sweat_smile:

Do you mean LayerCollector > Folder > LayerCollector? (ScreenGuis, SurfaceGuis, BillboardGuis, AdGuis, and probably more inherit LayerCollector).

If so, that would actually be more memory intensive than just doing Folder > LayerCollector or LayerCollector > LayerCollector but if you use the former, you’d still run into the unexpected behaviour of the UI resetting on spawn regardless of the ResetOnSpawn property.

In either case unless you’re doing this hundreds or thousands of times, the memory impact should be negligible.

I wasn’t exactly referring to ScreenGui’s, moreso other pieces of GUI like Frames, Labels, Buttons, etc.

I was thinking this at first: LayerCollector > Folder > UI elements as well as Folder > LayerCollector > UI elements, but as reading your comment, yikes, it seems that both of these strategies are not good and can behave differently from what I can expect…

I see, LayerCollector > Folder > UI elements is fine - you would get expected behaviour. The main issue (UIs resetting on spawn) arise only when LayerCollectors are not parented to other LayerCollectors as a descendant of the PlayerGui.

So, LayerCollectors > LayerCollectors > Folder > UI elements (with/without containing ScreenGui) would behave normally and somewhat fix the issue with UIs resetting on the spawn, right? Please correct me if I am wrong…

LayerCollector > LayerCollector > Folder > GuiObject (Frames, ImageLabels, Buttons, etc) is ok
LayerCollector > LayerCollector > Folder > LayerCollector is not ok, you will run into the issue of UIs resetting on spawn.

1 Like

Genius! :exploding_head: I will make sure to remember this in mind!! :blue_heart:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.