Replication order not functioning properly

Reproduction Steps
Currently, it appears that the replication order of instances vs. localscript execution does not function properly at random.
If there is a LocalScript in StarterPlayer.StarterPlayerScripts, it is guaranteed that all instances in the datamodel (Workspace, ReplicatedStorage, etc) will be fully replicated to the client before any of said LocalScript instances are executed : When to wait for replication to the client

However, at random, this appears to not be the case.

There is no easy way to reproduce this, however this issue pops up in my error analytics sometimes.
Here’s the code that errors in my game:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local UI = ReplicatedStorage.Assets.UIs.Health_UI:Clone()
Players.[LocalPlayer].PlayerScripts.Controllers.AvatarController.HealthUI: Health_UI is not a valid member of Folder "ReplicatedStorage.Assets.UIs",
Players.[LocalPlayer].PlayerScripts.Controllers.AvatarController.HealthUI, line 13

Expected Behavior
It is expected that any objects in the datamodel will be completely replicated before any localscripts under StarterPlayerScripts are executed.

Actual Behavior
Sometimes, at random it appears LocalScripts under StarterPlayerScripts will be executed before the datamodel has finished replicating.

Workaround
There is no workaround.

Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Sometimes
Date First Experienced: 2021-10-26 00:10:00 (-04:00)

1 Like

There was a bug related to join processing that could have possibly affected game servers launched between 2021-10-25 11:30AM PDT - 2021-10-26 08:00 PM PDT

Do your analytics continue to show the error happening? If it has started to trail off after 8PM PDT last night then it may be the same root issue.

I attempted to create a minimal repro file but I did not yet have success reproing the issue in Roblox Studio even with the buggy code enabled. Do you possibly have a place file that you are comfortable with sharing publicly that repros the issue?

PlayerScripts_HealthUI.rbxl (1.1 MB)

2 Likes

This issue occurred on October 21st, before that join processing bug you mentioned was happening.

This issue occurred during an alpha QA test for an upcoming game of mine, so the game only had players for about an hour. As such, there are no analytics outside of the 21st.

I’m not really sure how to reliably reproduce it. Out of the 350+ players that were testing the game, the error only occurred for a single player in an hour long test session, according to my analytics.
I’m not comfortable uploading my game here obviously, but I’d be happy to send you the place file in DMs or somesuch if you would like the place file!

Yep, a place file shared in DM would work.

As a sanity check: the guarantee we have is about instances that are already in the datamodel as of slightly before the PlayerAdded signal fires. The UI elements that you are looking for: are they guaranteed to be present before the player(s) join (e.g., they are not created by scripts at startup, scripts that might yield for unknown amounts of time, say for datastore or httpservice requests)?

Great! I’ll DM you the version of the game that experienced the issue.

As you will see in the place file I’m sending you via DMs, the UI exists in ReplicatedStorage.Assets.UIs in studio. Nothing creates it at run-time.