PlayerGui defeats purpose of RemoveDefaultLoadingScreen

Some background:

  • A LoadingScript displays a loading GUI while objects are being replicated from the server to the client.
  • By default, this GUI is removed once the conditions that fire game.Loaded are met.
  • If there are objects under ReplicatedFirst, then this GUI will be removed 5 seconds after ReplicatedFirst finishes (specifically, the conditions that fire ReplicatedFirst.FinishedReplicating).
  • This GUI can be removed early by calling RemoveDefaultLoadingScreen.
  • The earliest way to call this function is from a LocalScript under ReplicatedFirst.
  • The intended way to use this feature is to replace the default loading GUI with a custom one.

The problem:

  • The only way to display a custom loading GUI is by using PlayerGui.
  • The PlayerGui is replicated as a regular object along with the rest of the game; it does not have any particular priority.
  • Because the PlayerGui is inserted into the game tree on the server, ends up being among the last objects replicated to the client.

The end result is that no custom loading GUI can be displayed while the game is loading.

Some solutions:

  1. Give priority to PlayerGui, such as by making it a condition to ReplicatedFirst finishing.
  2. Add another means of displaying GUIs; create a container that can be added to ReplicatedFirst, which will render GUIs placed under it.

Site-note: the PlayerGui can either be or not be a condition to game.Loaded. It is added to the game tree independently of the replication process, so a race occurs between it and game.Loaded replication. This can occur with any object that is inserted into the game tree, depending on the timing of the insertion, player connection, and ReplicatedFirst.

24 Likes
local gui=...
game.Players.PlayerAdded:connect(function(player)
     gui:Clone().Parent=player:WaitForChild('PlayerGui')
end)

Basically ReplicatedFirst

Current work-around: BillboardGui

I like this idea a lot actually.

1 Like