Flux - Sync Server and Client State Easily

Keeping server and client data synchronized in Roblox can become difficult as games grow. Flux provides a simple way to create shared state that automatically replicates changes from the server to clients while keeping your code clean and reactive. Built on top of Replica, Flux adds a schema-aware state API with proxy-based updates, validation, batching, and client-side signals.


Why use Flux?

Managing server and client state in Roblox can quickly become complicated. As your game grows, you may find yourself creating many RemoteEvents, manually syncing data, and maintaining separate versions of the same information.

Flux simplifies this by giving you a single source of truth for your game state.

Instead of manually telling every client when something changes:

RemoteEvent:FireClient(player, "HealthChanged", 90)

you update your state naturally:

state.Health = 90

Flux handles the rest:

  • Automatically replicates changes from server to clients
  • Keeps your data structure consistent with schemas
  • Provides reactive signals for UI and gameplay systems
  • Reduces repetitive networking code
  • Makes large systems easier to organize and maintain

Whether you are building player data, inventories, character systems, settings, or any other shared game state, Flux gives you a clean and scalable way to keep everything synchronized.


Features

  • Proxy-based server state with natural table syntax
  • Server-side schema validation for writes
  • Batched updates with :Batch()
  • Replica-backed replication to clients
  • Event-driven client signals for changes, descendants, arrays, and dictionaries
  • Simple Get and OnReady APIs for client-side reads

Installation

Get the module (links at the bottom) and put it in a shared location such as ReplicatedStorage and require it from scripts on both sides:

local Flux = require(path.to.Flux)

The module exposes two entry points:

local client = Flux.client
local server = Flux.server

Server Example

local Flux = require(path.to.Flux)
local server = Flux.server

local state = server.new("PlayerState", {
    Schema = {
        Health = true,
        Stats = {
            Damage = true,
        },
    },
    Data = {
        Health = 100,
        Stats = {
            Damage = 10,
        },
    },
})

state.Health = 90

state:Batch(function()
    state.Health = 80
    state.Stats.Damage = 15
end)

state:Destroy()

Client Example

local Flux = require(path.to.Flux)
local client = Flux.client

local state = client.OnNew("PlayerState")

state:OnReady(function()
    print("Health:", state:Get({"Health"}))
end)

local healthSignal = state:GetChangedSignal({"Health"})
healthSignal:Connect(function(newValue, oldValue, path)
    print("Health changed:", newValue, oldValue, path)
end)

Common Use Cases

Flux can be used for:

  • Player data synchronization
  • Inventory systems
  • Character stats
  • Combat state
  • UI state
  • Settings synchronization
  • Shared game state
  • Client-server data replication
  • And more

Installation Links

Fork the repository
– Temporarily removed from Creator Store

Using Wally:
flux = "gamingguy84/flux@0.1.9"

5 Likes