Replication testing

UPDATE 09/24/2020: This project is no longer maintained.


I’m not technically versed by any means. I only know how to write basic code in Lua.

I’ve had a recent fascination in replication especially with all the support topics lately. Along with that, I strongly feel like I’ve been providing misinformation or misinterpreting some threads. With these things in mind, I’m going to log some of my tests here.

Why post it on the DevForum? I check here every day so it’s easier to remember than crowding it on my trashy computer. On the off chance someone discovers this thread, well, free resources and information to read up on. Not like it’s too interesting.

Hope this gives me better insight to replication and so I can provide better, more accurate information.

4 Likes

References


Official

Speculative

Notes

  • Both posts in the speculation category are written by a platform expert, but are based on observations and are not representative of actual ordering.

  • The official posts, specifically “When to wait for replication to the client”, explains (?) replication ordering but I frankly don’t know what to believe. I’ll try seeing if my tests align up with that. If so, I’ll have my answer regarding ordering.

  • “When to wait for replication to the client” was written later than Anaminus’ chart, meaning that such discussion must have spurred engineers to respond with an official statement. I still use the latter post more often but maybe I should start using the former.

  • These tests could be completely stupid and unnecessary since an engineer literally wrote a post about replication. I’d still like to test around a bit though, get the gears going.

1 Like

New confirmations:

  • WaitForChild is not required to access static instances in ReplicatedStorage for LocalScripts running in PlayerScripts.

  • StarterPlayerScripts LocalScripts are protected by game.Loaded by nature of being a starter container (this should be implied given its name).

  • PlayerScripts does not implicitly exist under the LocalPlayer, even to a LocalScript running from there. WaitForChild is required to access it externally. Not yet sure if script.Parent returns PlayerScripts despite this behaviour.

Testing materials:

  • ModuleScript with default source in ReplicatedStorage
  • LocalScript in StarterPlayerScripts

Source code:

Required ModuleScript:

local a = require(game:GetService("ReplicatedStorage").ModuleScript)
print(a) -- table: mem_address

PlayerScripts access:

local a = game:GetService("Players").LocalPlayer.PlayerScripts
print(a) -- Not reached, throws error

Several of my past projects as well as those I’ve taken part in or the helm over abuse WaitForChild for static instances in ReplicatedStorage, especially with regards to our library loader utility. As this module starts in ReplicatedStorage, it is static and WaitForChild is not required for it from LocalScripts.

I’m going to have a real blast refactoring, aren’t I…

3 Likes