Currently, the only way to render graphical interfaces on Roblox is by placing it under the PlayerGui
instance that is (usually) automatically created under every Player
instance.
This has many downsides with relation to developer ergonomics and performance, namely:
- The GUIs get unnecessarily replicated for every player, but only when their character spawns. This makes working with GUIs before a character has spawned hard to pull off.
- To have your GUI components dispatched, you must put it inside the
StarterGui
singleton. This is also the only place where they will render inside studio, which makes its runtime behavior seem unintuitive. - The existence of both the
PlayerGui
and its intended contents are not determined, because they are cloned based on character spawning. This leads to ugly and very hard-to-debug:WaitForChild
chains.
Among many other problems. Because of this, I believe introducing a new, separate singleton will help mitigate these issues and make GUIs a little less of a hassle to manage both internally and programmatically.
The Proposal
Add a new service, named something like Graphics
or Interface
, which acts similar to a PlayerGui
. When a client connects, the contents of this service will be replicated before any local scripts run.
Every GUI component in this container will be rendered, just like they are in PlayerGui
. These components will also render in the Studio viewport, just like if they were in StarterGui
. Changes on the server will be attempted to be replicated on the client like any other replicated container.