EZReplicator (Server-Client Replication Module)

Introduction

Have you ever had trouble replicating values between the server and client? Do you find sending signals between client and server a hassle, having to create RemoteEvents and RemoteFunctions for every little thing you replicate? Do you often find Replication modules to be complicated, abstract, or hard to utilize?

If you find any of the scenarios above to be relatable, then this module might be the perfect fix to your problems! I’d like to introduce EZReplicator, a module made with the sole purpose of replicating values between client and server with a very easy to use module! With EZReplicator, server-client replication is hassle-free. No more creating RemoteEvents or RemoteFunctions for every little thing you may need to replicate. Instead, create a Subscription object, or send signals and request data via the EZReplicator module!

The benefits of using EZReplicator for replication purposes in your experience are:

  • Easy to learn - EZReplicator is a module that is very easy to learn. It is meant to be beginner friendly, using mostly Getter and Setter functions
  • Easily organize anything replication - EZReplicator makes it easy to organize your RemoteEvents and RemoteFunctions, because, with this module, there is no need to create any RemoteEvents or RemoteFunctions!
  • Reliable, easy to fix errors - EZReplicator is meant to be a reliable module. It outputs custom error messages, making it easy to spot and fix errors

Example Code

To show how simple it can be to use, let’s look at some example code!

In the server,

--// services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--// modules
local EZReplicator = require(ReplicatedStorage:WaitForChild("EZReplicator"))

--// create subscription
local MAIN_SUBSCRIPTION = EZReplicator:CreateSubscription("MAIN", {
    Foo = "Bar",
    Hotel = "Trivago",
})

--// wait for a bit so that the client gets the subscription
task.wait(5)

--// add some new properties and change some property values
--// this should replicate the properties in the client
--// it also fires a signal in the client
MAIN_SUBSCRIPTION:AddProperty("New Property", "Something in here")
MAIN_SUBSCRIPTION:AddProperty("New Property 2", "Something else in here")
MAIN_SUBSCRIPTION:SetProperty("Foo", "Wassup homie")

In the client,

--// services
local ReplicatedStorage = game:GetService("ReplicatedStorage")

--// modules
local EZReplicator = require(ReplicatedStorage:WaitForChild("EZReplicator"))

--// wait for main subscription
local MAIN_SUBSCRIPTION = EZReplicator:WaitForSubscription("MAIN")

--// detect when a property has been changed in the MAIN subscription
--// this basically logs any changes made to the subscription
MAIN_SUBSCRIPTION.PropertyChanged:Connect(function(propIndex, propValue)
    print(tostring(propIndex) .. ": " .. tostring(propValue))
end)

This code should print an output every time a property in the created Subscription is changed! It’s that simple!


Summary

This module is completely open source, you can get it here!

Would you like to see the full documentation of EZReplicator? Well luckily, I documented it!

https://bhristt.github.io/EZReplicator/

Want to see the github repository, or add EZReplicator to your experience using Rojo? Here’s the github repository link!

I hope this helps you out in any of your server-client replication needs!

5 Likes

Immediately after giving this post a short read my impressions is that this would serve much utility to those who at the least understand fundamentals of programming / scripting. I know if I was just starting out I would probably use this extensively this in my projects back then.

I often see people who are starting out asking why and how a value they have on the client isn’t replicated to the server, and there is an element of confusion there. I will recommend this in future situations.

2 Likes

Good job man! I will definitely look deeply into it once I can.

I am sure beginners would love to use this! It could absolutely benefit them.

1 Like

Hey nice module, why would this be more efficient/better than replicaservice?

1 Like

Thank you!

I’m sure ReplicaService has many more benefits than my module, but the main issue I tried to focus on while creating this module is it’s ease of use. I often find that beginners have a very difficult time figuring out how to replicate things between Server and Client, and other modules are very complicated to understand for beginners.

This module is meant to be a middle ground for beginners and advanced scripters. It’s a lot easier to use than ReplicaService, and it comes with multiple functions with specific names to make it easier to understand for beginner scripters.

1 Like

Very impressive module once again @bhristt !! This will help many Developers!

Although this topic is very old and the script itself is also very old, I want to thank you for doing something as useful as this, sadly ReplicaService is very difficult to understand and learn because of its garbage documentation :frowning: