search/
Start typing to search packages!
package_2
re-save
By @ernisto
Roblox
Mirrored from Wally[image: re-save icon]
re-save
Session-based DataStore saving for Roblox, with an oplog, schema migrations and multi-key transactions.
Docs · Tutorials · Examples · API Reference · Download
Features
- No session locks: a key can be open on more than one server. Each session keeps its changes in an oplog and replays them on the newest saved data, so no change is lost.
- Change now, save later:
queueupdatechangessession.dataat once; the oplog is saved in the background, onfreeand on shutdown. - Versioned schemas: migrations upgrade old saves when they load, and are test-run when the schema is built, so a broken one fails at startup.
- Transactions:
savebatchchanges several keys at once, or none of them.
Installation
- Wally: add to
wally.toml, then runwally install
[server-dependencies]
resave = "ernisto/re-save@0.1.0-alpha.7"
- pesde:
pesde add wally#ernisto/re-save
- Model file: download
resave.rbxmfrom the latest release and put it in ServerScriptService.
Quick look
local Players = game:GetService 'Players'
local ServerScriptService = game:GetService 'ServerScriptService'
local resave = require(ServerScriptService.ServerPackages.resave)
local players = resave.store('players', {
schema = resave.schema { coins = 0 },
})
Players.PlayerAdded:Connect(function(player)
local err = resave.track(players, tostring(player.UserId))
if err then player:Kick 'Could not load your data, please rejoin' end
end)
Players.PlayerRemoving:Connect(function(player)
local session = resave.maybetracked(players, tostring(player.UserId))
if session then resave.free(session) end
end)
local function earn(player, amount)
local session = resave.maybetracked(players, tostring(player.UserId))
if not session then return end
resave.queueupdate(session, function(data)
data.coins += amount
end)
end
New here? Start with the tutorials.
License
MIT. re-save is rewritten from drop by jackhexed (formerly jackdotink), also MIT licensed.
Package Details
Install command (Click to copy)
Version
0.1.0-alpha.1
License
MIT
Safe for commercial use
Automated license review — not legal advice.
