I have a question, I was looking through the documentation and I believe I read somewhere that you cannot transfer models, unless they are in replicated storage, which was correct. I’m wondering why this is. I’ve managed to return models in remote functions, then load them into the player’s world. Why can’t this be done using ReplicaService?
Also great module, it seems very stable and well made!
The whole idea of ServerStorage is to be server-side only - it serves no additional purpose. Likewise, ReplicatedStorage is both server-side and replicated to clients. Both ServerStorage and ReplicatedStorage allow you to handle instances on the right machines as you expect, so if you need instances available on all machines you put them in ReplicatedStorage.
I read somewhere that saving large models (in this case maps) can use the clients memory and degrade performance. I was thinking of experimenting in a chunk like system where the server tells the client what to load when the player enters a new area. But I’ll probably just handle things in replicated storage from now on.
Since all of Roblox networking is sequential you may safely copy a model from ServerStorage and parent it to the workspace and then set it as a Replica argument - the instance passed must be in a replicated container before the moment of passing the argument and all the way to the end of the Replica’s lifetime (:Destroy()).
Well that brings a new question: How do I replicate the model to only a specific client? When cloning and parenting the model to the workspace, wouldn’t it be replicated for all players?
There exists no selective instance replication on Roblox. The closest thing to that is clients cloning models from ReplicatedStorage (or creating their own) to make completely client-side instances - this method will make the model invisible to the server and other clients and if you’re using ReplicaService you’d create the client-side model after the replica is received.
Is there a way to replicate state to all clients except one? I’m trying to write a system where a player can make changes to the state of its replica, then send that back to the server to replicate to everyone else. I don’t want the server “returning to sender” because the player could have made even more changes in the time it takes for the server to replicate.
The solution I have right now is replicating to all clients individually, then removing a client from this list when they “take ownership” of the replica using :DestroyFor(player).
You kind of answered your own question lol. If a replica was never meant to be replicated for a specific player, then just don’t pass their reference to :ReplicateFor().
When using Replica:ReplicateFor() does passing a Player instance add them to the dictionary of players that the Replica is or does it overwrite the whole dictionary to now only replicate to that player.
If it just adds them, would you consider expanding the functionality of Replicas to have a function like Replica:SetReplication() which might allow for adjusting the Replication property like you would on Replica creation (“All”, {[Player1] = true, [Player2] = true, …}, Player) ?
There’s no need for a table argument in ReplicateFor, because it wouldn’t help the module make this change any more efficiently. Just call it for every individual player.
We use this library in Wild Worms and it makes iterating on existing network features super easy. It also helps abstract away all of the code that handles keeping track of things like worms, pickups, and player profiles and instead lets us focus directly on adding/fixing features. I would love to make a video on our use case soon!
Are there any examples of handling replicas across multiple client scripts? The things I have tried so far have lead to issues with the listeners potentially being set up after .RequestData(), or scripts attempting to index (from a central module) replicas that weren’t recieved yet.
Is this just an issue with using more than one localscript?
Regardless of what you use, you’ll need some sort of load sequence manager that will know when to call RequestData() after all scripts / modulescripts made their connections
Hey, rather than easily supporting server-client replication, is there a way you can implement a much easier way to allow a client to communicate with the server? Right now, I generally believe it’s more difficult than to manually create a remote event.
Is there any way I can request data to be changed FROM the client TO the server? For example, what if a player clicks a button that toggles a mute radio setting. Would I have my own remote event request FireServer() to update that setting, and then on the server verify the parameters?