Document RemoteFunction replication behavior

When a LocalScript calls remoteFunction:InvokeServer(), it will yield until any necessary replication processes are complete within the associated OnInvokeServer’s main thread.

For instance, if the OnInvokeServer function creates 10,000 parts in the game, then the client that invoked the function will yield until all 10,000 parts are completely replicated to that client. It does not yield server-side; only client-side.

I believe this behavior should be documented for RemoteFunctions.

Here is more information regarding this behavior:
https://devforum.roblox.com/t/remotefunction-yields-until-replication-is-completed/184907

3 Likes

I believe this is more general, i.e. any replication action that occurs between the remote function being received by the server and the remote function being returned will delay replication of the result.

For example: if the remote function starts, then does a task for 2 seconds, and within that task another thread decides to spawn in 10,000 trees, those will also delay the result AFAIK. Correct me if wrong though.

The documentation request here should be to document the behavior where everything replicates in order.

6 Likes

Similarly, OnClientEvent won’t fire until whatever you pass it replicates.
remoteevent replication behavior.rbxl (13.3 KB)

1 Like

Thanks for the report.

This is something we are aware of and will be looking into.

2 Likes

Sweet, thanks. Been loving the quick responses to these doc requests