[Module] ServerSync – Real-Time Server Synchronization

ServerSync – Real-Time Server Synchronization

ServerSync is a Roblox module designed to synchronize data across different server instances. It uses MessagingService and DataStoreService for efficient data management and real-time updates.

Key Features

  • Real-Time Synchronization: Keeps data consistent across all server instances.
  • Event-Driven Architecture: Uses the Signal module to handle data changes.
  • Simple API: Easy to integrate and use in your projects.

Installation

  1. Download the Module: Obtain the module here: ServerSync.
  2. Require the Module:
    local ServerSync = require(game:GetService("ReplicatedStorage").ServerSync)
  3. Initialize the Module: Use the module as you need 😜

API Reference

ServerSync

  • ServerSync:CreateDataStore(Key: string): DataStore
    • Description: Creates a new DataStore with the specified key.
    • Parameters:
      • Key (string): The key for the new DataStore.
    • Returns: DataStore - The newly created DataStore object.

DataStore

  • DataStore:GetAsync(Key: string, Template: table): Data
    • Description: Gets the data for a specific key asynchronously.
    • Parameters:
      • Key (string): The key to retrieve data for.
      • Template (table): The template to use if data does not exist.
    • Returns: Data - The Data object for the key.

  • DataStore:Get(Key: string, Template: table): Data
    • Description: Gets the data for a specific key synchronously.
    • Parameters:
      • Key (string): The key to retrieve data for.
      • Template (table): The template to use if data does not exist.
    • Returns: Data - The Data object for the key.

  • DataStore:Release(Key: string)
    • Description: Releases the data for a specific key.
    • Parameters:
      • Key (string): The key to release data for.

Data

  • Data:Get(): any
    • Description: Gets the current data.
    • Returns: any - The current data.

  • Data:SetAsync(Path: table, NewValue: any)
    • Description: Sets the value at a specific path in the data table asynchronously.
    • Parameters:
      • Path (table): The path to set the new value at.
      • NewValue (any): The new value to set.

  • Data:Release()
    • Description: Releases the data and cleans up the associated resources.

Examples

Creating a DataStore:

local dataStore = ServerSync:CreateDataStore("MyDataStore")

Getting Synchronized Data:

local data = dataStore:GetAsync("Player123", {
    stats = {
        score = 0
    }
)
print(data:Get())

Setting Data:

local playerData = dataStore:Get("Player123")
playerData:SetAsync({"stats", "score"}, 500)

Handling Data Changes:

local data = dataStore:Get("Player123")
data.Changed:Connect(function(newData)
    print("Data changed:", newData)
end)

Support and Feedback

For support, please dm me from:


Discord: .furukan
X / Twitter: FurukanDev




Rate The Module!
  • 1
  • 2
  • 3
  • 4
  • 5

0 voters

7 Likes

Looks pretty useful for cross-server communication. Keep up the good work !! :+1:

1 Like

not send you to the link by press “ServerSync”

thanks for informing, fixed that :pray:

1 Like