DataStore & Persistent Storage

Storage

Roblox DataStoreService integration, schema definitions, retry policies, and low-latency Studio fallback.

# Overview

Security states (such as active bans, incident evidence dossiers, and administrative audit trails) must persist reliably across server restarts and place updates.

StorageService.luau abstracts persistent storage, handling serialization, exponential backoff retries, and seamless fail-safe switching when Roblox APIs are unavailable.

       Write Operation (SaveBan / SaveIncident)
                         │
                         ▼
             RunService:IsStudio()?
             ├── YES ──► Write to localMemoryBans (Zero latency, no API limits)
             └── NO  ──► Execute pcall DataStoreService:UpdateAsync / SetAsync
                         │
                         ├── Success: Return true
                         └── Failure: Retry with exponential backoff & log warning

# DataStore Schema Definitions

RAC registers 3 isolated DataStores to maintain clean separation of concerns:

# 1. Bans DataStore (RAC_Bans_v1)

Key: tostring(userId)
Payload:

{
  "id": "uuid-v4-string",
  "userId": 12345678,
  "username": "ExploitPlayer1",
  "punishmentType": "PermBan",
  "reason": "Deceptive Honeypot Trigger",
  "evidence": "Fired ClaimFreeRobux remote at tick 1420",
  "issuedAt": 1718000000,
  "expiresAt": null,
  "issuedBy": "RAC AI Engine",
  "active": true
}

# 2. Incidents DataStore (RAC_Incidents_v1)

Stores serialized telemetry dossiers for high-risk and critical incidents, preserving player speed, coordinates, ping, and matched signatures for subsequent review.

# 3. Audit Trail DataStore (RAC_AuditLog_v1)

Chronological record of every administrative action, including moderator UserID, target player, and timestamp.


# Studio Memory Fallback Mode

Testing anti-cheat code in Roblox Studio can be frustrating when DataStoreService throws permission errors or rate-limit warnings.

RAC solves this automatically:

  • When running in Studio (RunService:IsStudio() == true), StorageService routes all reads and writes to an internal in-memory cache (localMemoryBans).
  • Testing bans, unbans, and incidents requires zero DataStore API setup and executes with zero network latency.
  • In production live game servers, RAC connects to Roblox's distributed cloud DataStores.

# Configuration

In ServerScriptService/RAC/config.luau:

Config.Storage = {
    Enabled = true,
    SaveIncidents = true,
    SaveBans = true,
    SaveAdminActions = true,
    MaxCachedIncidents = 100,
    AutoSaveIntervalSeconds = 60,
}

# Next Steps