Forest Logo
search
package_2

shared-modules

By @marvmax

Roblox

Mirrored from Wally

Roblox Shared Modules

Reusable Luau libraries for Roblox games.

Modules

DataManager.luau

Generic, configurable player data persistence layer for Roblox using DataStoreService.

Features

  • Configurable Schema: Define default stats, types, and values in one table.
  • Automatic Leaderstats: Automatically mirrors specified stats to the player leaderstats folder.
  • Auto-Saving: Background loop automatically saves all players at configurable intervals.
  • Graceful Shutdown: Automatically connects to BindToClose and PlayerRemoving to prevent data loss.
  • Studio-Safe: Gracefully handles Studio environments where DataStore API access might be disabled.
  • Strict Luau: Fully typed with --!strict.

Usage Example

--!strict
local DataManager = require(game:GetService("ServerScriptService").SharedModules.DataManager)

local PlayerData = DataManager.new({
    dataStoreName = "PlayerData_v1",
    autoSaveInterval = 120,
    resetOnJoin = false,
    defaultData = {
        Gems = 0,
        Stage = 1,
        Inventory = {},
    },
    leaderstats = {
        Gems = "IntValue",
        Stage = "IntValue",
    },
})

PlayerData.init()

return PlayerData

Package Details

Install command (Click to copy)


Version

0.1.0

License

MIT

check_circle

Safe for commercial use

infoThe package archive does not include its license text; the license is declared in its manifest metadata.

Automated license review — not legal advice.