Reduct
GitHub
currently can’t get on the Creator Marketplace for whatever reason >:(
Reduct is a lightweight module designed to manage manual client–server replication. By giving developers explicit control over what data is synchronized and when, it avoids the overhead of Roblox’s automatic instance replication significantly reducing unnecessary updates and server traffic.
This documentation covers how to use Reduct, along with practical use cases and implementation examples.
Thanks to AlexanderLindholt for creating the Signal+ module, which is used heavily throughout this module.
Objects
Status
Properties
Status: "pending" | "dead" | "complete";
StatusID: string;
TrackedObject: Instance;
Owner: Player;
Changed: Signal;
The Status object represents the lifecycle of a replicated object.
If its state changes from "pending" and the status is not stored, it will fall out of scope.
Changed fires when:
- A player leaves before confirming replication (
"dead") - Replication completes successfully (
"complete")
Tracker
Properties
ListenTo: (self: Tracker, Topic: string) -> Signal;
Listen: (self: Tracker) -> Signal;
This is a client-only object used when an object is loaded on the client. It allows you to attach handlers to the update stream.
Listenis wildcard-based and listens to all topics, passing the topic as the first argument.ListenTolistens to a single topic only.
When an object is unreplicated or destroyed, the tracker will fall out of scope unless it is explicitly stored.
Functions
Reduct.ReplicateTo | SERVER ONLY
Replicates an object to one or more clients.
Example
Reduct.ReplicateTo(ObjectToReplicate, Players:GetPlayers())
Returns: { Status }
Reduct.UnReplicate | SERVER ONLY
Tells clients to unreplicate an object.
If the object is not currently replicated on the client, this function will simply return.
Example
Reduct.UnReplicate(ObjectToReplicate, Players:GetPlayers())
Reduct.ReplicateChanges | SERVER ONLY
Sends updates for a given topic to the client.
This is where the Tracker object comes into play.
Example
Reduct.ReplicateChanges(ObjectToReplicate, Players:GetPlayers(), "test", ...)
Reduct.Track | CLIENT ONLY
Returns a Tracker that receives updates for an object replicated using Reduct.ReplicateChanges.
Example
Reduct.Track(Target)
Returns: Tracker
Reduct.IsReplicated | SERVER ONLY
Returns a dictionary of player : boolean the bool will be true if replicated.
Example
Reduct.IsReplicated(Instance, Players:GetPlayers())
Returns: { [player] : boolean }
Properties
-
Replicated
A folder where all replicated instances are placed on the client. -
OnReplication
A client-only event that fires whenever an object is replicated to the client.
Extra Info
- If a replicated object is destroyed on the server, clients will be instructed to deconstruct the object on their end.
- Configuration options are included. Currently, there is one config that warns if an object being replicated is not a descendant of
ServerStorage.
Collaborators
Kobayashi - A good friend of mine who helped work on this module.