Question about cloning from ReplicatedStorage on the server

If a server script clones an object from ReplicatedStorage and places it in the Workspace (or any other place that replicates), how is it replicated over to the clients?

Does it…
A) Send the raw data of the copied object and its descendants to every client?
OR
B) Does the server send a message to each client to tell it to copy the client’s cached version of the object from replicated storage?

I’m trying to understand this to see if cloning a certain object on the server will take a lot of bandwidth if I copy it in large numbers.

2 Likes

Items inside ReplicatedStorage are already loaded onto the client even before they are replicated onto the Workspace. When you load an item from ReplicatedStorage into workspace, the game will just tell the client the item exists and it’s position since the client already has a file of the item.

The point of ReplicatedStorage is to replicate items into both the server and client upon game startup.

4 Likes

Ok thank you!

Just to confirm that I’m understanding this right, what steps happen if we run the following example?

  1. A server script called “FieldMake” clones a Model called “SoccerNet” from ReplicatedStorage.
  2. FieldMake clones a different Model called “SoccerBall” and parents it to the new SoccerNet.
  3. FieldMake offsets the SoccerBall by (0, 8, 0).
  4. FieldMake clones a Script called “GoalCheck” from ServerStorage and parents it to the SoccerNet.
  5. FieldMake parents the SoccerNet to Workspace.

Does it the above end up working like this client side?:

  1. Client gets the SoccerNet and SoccerBall from its local copies in ReplicatedStorage.
  2. Client moves SoccerBall up by 8.
  3. Client puts SoccerNet in the Workspace.
  4. Client receives a copy of GoalCheck from the server and sets its parent to SoccerNet.

Correct, except server sided scripts are not replicated across the client as it isn’t necessary.

1 Like

Thank you! That clears everything up.

Server-sided scripts, if in ReplicatedStorage, will replicate to the client - the instance itself still follows standard replication rules. Their sources (or more rather the bytecode for the script), however, are not sent to the client.

The script he was referencing was located in ServerStorage, not ReplicatedStorage.

I think he was just making the point that if the server script is in a container that replicates (like ReplicatedStorage or the Workspace as in my demo thingy above) that the instance of the script object itself is still copied even if the code isn’t.

1 Like