Skip to content

ericplane/Scribe

Repository files navigation

Scribe

Persistent, fully-typed, automatically-replicated player data for Roblox Luau, built on ProfileStore.

📖 Full documentation → ericplane.github.io/Scribe 🔌 Studio plugin → Scribe Studio

# wally.toml
[dependencies]
Scribe = "ericplane/scribe@1.0.6"
  • Fully typed. A type-solver-generated accessor tree types your data end to end (data.Coins.Increment(50), nested containers, arrays, and datatype fields), checked at compile time.
  • Replication for free. Schema-compressed batched diffs stream to clients over a pluggable transport, and you read the same data on the client with the same API, with no RemoteEvents to wire up.
  • Production-grade. Migrations, a wipe guard, version history, GDPR export and erase, leaderboards, gifting and perks, and fail-closed monetization all sit on top of ProfileStore's session locking.

Important

The typed API needs the new Luau type solver (Studio: select Workspace and set UseNewLuauTypeSolver to Enabled; or enable it in your Luau LSP settings). Scribe runs correctly without it. Data.Raw is the untyped escape hatch.

Quick start

One shared module declares the template and options and returns { Server, Client }:

-- ReplicatedStorage/Shared/Data.luau
local Scribe = require(game:GetService("ReplicatedStorage").Packages.Scribe)

return Scribe({
    Template = { Coins = 0, Settings = { Music = true } },
    ProfileStoreIndex = "PlayerData", -- required: your DataStore name
    ProfileKeyPrefix = "PLAYER_",     -- required: per-player key prefix
})
-- Server: wait for the profile to load, then use the typed accessor
local Data = require(game:GetService("ReplicatedStorage").Shared.Data).Server

game:GetService("Players").PlayerAdded:Connect(function(player)
    local data = Data.WaitForData(player) -- yields until Ready (or ~60s timeout)
    if data then
        data.Coins.Increment(50)
    end
end)
-- Client: read the same data reactively (writes are local-only; server wins)
local Data = require(game:GetService("ReplicatedStorage").Shared.Data).Client

Data.Coins.Observe(function(coins)
    coinsLabel.Text = tostring(coins)
end)

For declarators, replication + visibility, monetization, leaderboards, migrations, diagnostics, and the full API, see the documentation.

Development

rokit install            # wally + rojo + selene + luau-lsp + lune toolchain
wally install            # dependencies
selene src test lune     # lint
lune run lune/run-tests  # run the test suite (headless, ~1s)

Docs are built with Material for MkDocs from the doc-comments in src/ and the guides in docgen/guides/. See docgen/README.md for details.

License

MIT

About

Persistent, fully-typed, automatically-replicated player data for Roblox Luau, built on ProfileStore.

Resources

License

Stars

3 stars

Watchers

1 watching

Forks

Contributors