Player data operations: support, restores and erasure

Run player data support for a live Roblox game with Beacon Yard, from a lost-coins ticket through the Data Stores Manager, entry versions and a safe Lune restore tool, to right-to-erasure templates, the erasure webhook and the privacy rules for player data.

Concept lesson, about 70 minutes, 12 steps

By the end you can

  • Find a player's ProfileStore entry in the Data Stores Manager, read its version history and know which versions Roblox keeps
  • Restore lost progress with a Lune tool that merges an old revision into the current profile, refuses while a server holds it, and keeps the entry's users
  • Set up right-to-erasure deletion for every key named after a user, and handle the webhook for data the templates cannot reach
  • Decide what player data a game may keep, log and send off Roblox, and when to ask a professional

Before this: Safety and compliance: ratings, age checks, policies, ProfileStore: the library pros use, Ecosystem tools: Lune, darklua, roblox-ts, Deploying with Open Cloud: staging and production

1A lost-coins ticket

The message reads: "I had 240 coins yesterday and now I have 3. I didn't buy anything." Beacon Yard at m14-ship keeps everything a player owns in one ProfileStore profile: coins, speedOwned, legacyImported, onboardingStep and recentPurchaseIds. It lives in the data store BeaconYard_v2 under the key Player_<UserId>, wrapped in ProfileStore's envelope (Data for those fields, MetaData for ProfileStore's own bookkeeping).

Support work starts with evidence, not with a gift. Adding 237 coins from an admin command feels kind, but it hides whatever went wrong, and it pays out again for every player who learns the trick of asking.

What should the person handling the ticket do first?

  1. Open the player's Player_<UserId> entry in BeaconYard_v2 and read its version history
  2. Add 237 coins with an admin command and close the ticket
  3. Ask the player for their password so you can log in and check
  4. Delete the profile so it starts fresh
Answer

Open the player's Player_<UserId> entry in BeaconYard_v2 and read its version history. The data store keeps versions of the entry. Read them first: they show whether the coins really dropped, when, and what to restore.

Open this step in lesson mode · Link to this step · This confused me

2Find the key in the Data Stores Manager

The Data Stores Manager is in Creator Hub: pick the game, then Configurations, then Data stores manager. It lists your data stores with their size and key count. Select one to list its keys, filter them with a prefix that starts with the scope name (Beacon Yard uses the default scope, global), and open a key to see its value, metadata, version history, status and last update1.

Creator Hub (illustration)
Illustration with sample data, not a live Creator Hub capture: the Data Stores Manager with BeaconYard_v2 open, one Player key selected, its ProfileStore Data and MetaData objects, and two UTC-hour versions selected for Compare versions.

Select a numbered pin, or a row below, to read what it marks.

Figure 2.1.

One profile entry, its ProfileStore envelope and its versions. Illustration with sample data, not a live Creator Hub capture.

Pick a version and press Compare versions to see it beside the current value. Revert writes a new version with the old value. The game owner has full access. In a group game, each role gets only what it needs: viewing the page, deleting keys, deleting whole data stores, or full access1. Give support staff the view role. Only the person who restores needs more.

A new support volunteer joins Beacon Yard's group. They answer tickets and confirm what happened. Which Data Stores Manager access fits?

  1. View only
  2. Delete keys
  3. Delete data stores
  4. Full access, so they never get stuck
Answer

View only. Support reads; one trusted person writes. The same least-privilege rule applies to API keys.

Open this step in lesson mode · Link to this step · This confused me

3Which versions Roblox keeps

Versions are not a full history. Roblox makes a versioned backup from the first write to a key in each UTC hour, and later writes in the same hour overwrite it. So each hour keeps only the last value written in it. A backup expires 30 days after a newer write replaces it, and the latest version never expires2. ProfileStore saves while the player is online and when they leave, so one evening of play leaves one version per hour.

Here is the player's day, in UTC. Run it to see what survived.

Luau
-- Saves of Player_<id> on one day, in UTC, with the coins after each save.
local writes = {
	{ at = "13:05", coins = 230 },
	{ at = "13:35", coins = 240 },
	{ at = "13:55", coins = 240 },
	{ at = "14:05", coins = 245 },
	{ at = "14:20", coins = 3 },
	{ at = "14:25", coins = 3 },
}
 
-- One version per UTC hour: a later write in the same hour replaces it.
local kept, hours = {}, {}
for _, write in writes do
	local hour = string.sub(write.at, 1, 2)
	if kept[hour] == nil then
		table.insert(hours, hour)
	end
	kept[hour] = write
end
 
for _, hour in hours do
	print(string.format("%s:00 hour keeps the %s write: %d coins", hour, kept[hour].at, kept[hour].coins))
end
Figure 3.1. Expected output: 13:00 hour keeps the 13:55 write: 240 coins 14:00 hour keeps the 14:25 write: 3 coins

The coins broke at 14:20. What is the highest coin value you can restore from these versions?

Answer

240 coins. The 14:00 hour's version holds the 14:25 write (3 coins), so the 245 from 14:05 is gone. The last good version is the 13:00 hour's, with 240. Hourly versions are a safety net, not a full history.

For updates that change how data is saved, there is a stronger net: the Snapshot Data Stores Open Cloud API takes a snapshot of every data store in the game, once a day. Take one right before such an update ships, and nothing written before it can be overwritten by the update's bugs2.

Open this step in lesson mode · Link to this step · This confused me

4Why a whole revert is the wrong fix

Revert puts back the whole entry: every field of Data, and ProfileStore's MetaData too. For a profile, that takes things away.

  • A Speed upgrade bought after 13:55 disappears.
  • Purchase ids recorded after 13:55 leave recentPurchaseIds, the list that stops a redelivered receipt from paying twice.
  • If the old version predates the import of the player's BeaconYard_v1 record, legacyImported goes back to false, and the next session imports those old coins a second time.
  • The old MetaData may still name a server session that ended long ago.

Stored dataRemember: Session lock is the vault sign-out sheet: Server A has this account, signed at 14:02.

The restore has a second trap. ProfileStore's sign-out sheet is MetaData.ActiveSession: it holds a table while a server has the profile, and it is empty once the session ends. If a tool writes the entry while the player is still in a server, that server's next save overwrites the restore with the broken values it holds in memory.

Where does it break?“The vault sign-out sheet: Server A has this account, signed at 14:02” is a good picture of session lock. Where does it stop being true?

It breaks here. Nobody enforces the sheet; it only works because every server that touches the key checks it, and an unrenewed lock looks expired.

The true model. A session lock records which server holds a player's data so two servers do not write it at once. Beacon Yard's hand-rolled lock expires after 45 seconds so a crashed server cannot hold a key forever. ProfileStore renews its lock with an autosave every 300 seconds.

Your Lune tool writes the restored profile through Open Cloud while the player is still playing. What stops the write?

  1. Nothing, unless the tool itself reads MetaData.ActiveSession and refuses
  2. ProfileStore blocks every write from outside the game
  3. Open Cloud refuses to write a key that a server is using
  4. The Data Stores Manager locks the key while it is open
Answer

Nothing, unless the tool itself reads MetaData.ActiveSession and refuses. Nobody enforces it. A tool that does not read ActiveSession writes over a live session, and that server's next save puts the broken values back.

Open this step in lesson mode · Link to this step · This confused me

5A restore tool that merges

The safe restore is a merge, done only while no server holds the profile. Keep the higher coins, keep Speed if either copy has it, keep legacyImported if either is true, keep the furthest onboarding step, and keep every purchase id from both copies, each once, at most 50. Those rules are pure functions, so they live in the challenge file challenges/work/data_ops.luau and the tool requires the same module.

The Open Cloud data stores API has what the tool needs3:

StepRequestScope
List revisionsGET .../entries/Player_<id>:listRevisionsuniverse-datastores.versions:list
Read an old revisionGET .../entries/Player_<id>@<revisionId>universe-datastores.objects:read
Write the mergePATCH .../entries/Player_<id>universe-datastores.objects:update

Two details from the reference matter. A PATCH replaces the whole entry: if you leave out users or attributes, they are cleared, so send back the ones you read. And send the etag you read, so a write that raced yours fails instead of being overwritten3. The users list is where DataService tags the entry with the player when their session starts:

	session:AddUserId(player.UserId)
	session:Reconcile()
Figure 5.1
luau
-- tools/restore.luau
--   lune run tools/restore list 12345 2026-11-20T14:20:00Z
--   lune run tools/restore apply 12345 <revisionId>
local net = require("@lune/net")
local process = require("@lune/process")
local serde = require("@lune/serde")
local DataOps = require("../challenges/work/data_ops")
 
local apiKey = process.env.ROBLOX_API_KEY
local universeId = process.env.ROBLOX_UNIVERSE_ID
assert(apiKey and universeId, "Set ROBLOX_API_KEY and ROBLOX_UNIVERSE_ID first.")
local command, userId, arg = process.args[1], process.args[2], process.args[3]
assert(tonumber(userId) and arg, "Usage: list <userId> <incident> | apply <userId> <revisionId>")
 
local entry = "https://apis.roblox.com/cloud/v2/universes/" .. universeId
	.. "/data-stores/BeaconYard_v2/entries/Player_" .. userId
 
local function call(method: string, url: string, body: any?)
	local response = net.request({
		url = url,
		method = method,
		headers = { ["x-api-key"] = apiKey, ["content-type"] = "application/json" },
		body = if body then serde.encode("json", body) else nil,
	})
	assert(response.ok, "HTTP " .. response.statusCode .. ": " .. response.body)
	return serde.decode("json", response.body)
end
 
if command == "list" then
	local revisions = call("GET", entry .. ":listRevisions?maxPageSize=100").dataStoreEntries or {}
	for _, r in revisions do
		print(r.revisionCreateTime, r.revisionId, r.state)
	end
	print("Restore from:", DataOps.pickRevision(revisions, arg) or "nothing before the incident")
elseif command == "apply" then
	local current = call("GET", entry)
	assert(DataOps.canWrite(current.value), "A server holds this profile. Ask the player to leave, then retry.")
	local old = call("GET", entry .. "@" .. arg)
	local value = table.clone(current.value)
	value.Data = DataOps.restoredData(current.value.Data, old.value.Data)
	call("PATCH", entry, {
		value = value,
		users = current.users,
		attributes = current.attributes,
		etag = current.etag,
	})
	print("Restored: " .. value.Data.coins .. " coins")
end

A teammate trims the PATCH body to just { value = value }. What changes for Beacon Yard?

  1. The entry's users list is cleared, so the player is no longer tagged on their own profile
  2. Nothing; Open Cloud keeps fields you leave out
  3. The write fails because etag is required
  4. ProfileStore rejects the profile on the next join
Answer

The entry's users list is cleared, so the player is no longer tagged on their own profile. Send back users and attributes with every value update. The user tag is what ties the entry to the player for data requests.

Open this step in lesson mode · Link to this step · This confused me

6Right to erasure: delete what is theirs

The opposite ticket also comes. Privacy laws give people a right to be forgotten: when someone asks Roblox to delete their account, Roblox notifies the creators of games they played, so those creators can delete personal data they no longer need4. Roblox's docs treat data broadly: if a piece of data can be traced back to a user, it may be personal data, and they give user ids as an example45. Roblox sends you a message each day listing the requests that need action, and you stay responsible for deleting everything they cover.

Deletion templates do most of it for you. You list where user data lives with a {UserId} token, and when Roblox processes a request it deletes the matching keys. A game can have up to 100 templates. The user id must be part of the data store name, key or scope, in a fixed pattern, in a standard or an ordered data store. The token is case-sensitive, and the scope defaults to global. Set them up in the Data Stores Manager's RTBF Deletion tab, or with the Configs API6.

Where an erasure request reachesAn erasure request box on the left splits into two paths: Roblox's deletion templates remove the three keys named after the user, and your webhook removes the r_ receipt rows that templates cannot match.Erasure requestone UserIdTemplatesRoblox deletesYour webhookyou deleteThree keysnamed after the userr_ rowsPlayerId in value
Figure 6.1. Templates match key names; anything else is your webhook's job.

Which Beacon Yard keys can a deletion template reach?

  1. Player_<UserId> in BeaconYard_v2 (the profile)
  2. <UserId> in BeaconYard_v1 (the old record from m09)
  3. <UserId> in the ordered store BeaconYard_BestMatch (the leaderboard)
  4. r_<purchaseId> rows in BeaconYard_v1, which store PlayerId inside the value
Answer

Player_<UserId> in BeaconYard_v2 (the profile); <UserId> in BeaconYard_v1 (the old record from m09); <UserId> in the ordered store BeaconYard_BestMatch (the leaderboard). The first three keys contain the user id in a fixed pattern, so Player_{UserId}, {UserId} and {UserId} (ordered) cover them. The r_ rows are keyed by purchase id; the user id is only in the value, so no template can find them.

Open this step in lesson mode · Link to this step · This confused me

7The erasure webhook, for what templates miss

For data a template cannot match, add a webhook: Configurations, then Webhooks, with the Right to Erasure Request trigger. Roblox posts JSON with NotificationId, EventType (RightToErasureRequest), EventTime and an EventPayload holding the UserId and GameIds, the start place ids of the games involved75. Your endpoint must answer with a 2xx within 5 seconds, Roblox retries a failed delivery 5 times, and the same NotificationId twice is a duplicate. With a secret set, verify the roblox-signature header first and reject old timestamps; Roblox's sample uses a 300-second window7.

Beacon Yard's handler deletes the user's r_ rows. The checks before it are pure, so run them here:

Luau
local START_PLACES = { 4100 } -- your start place id
 
local function userToErase(payload)
	if payload.EventType ~= "RightToErasureRequest" then
		return nil
	end
	local body = payload.EventPayload
	if type(body) ~= "table" or type(body.UserId) ~= "number" then
		return nil
	end
	if body.UserId < 1 or body.UserId % 1 ~= 0 or type(body.GameIds) ~= "table" then
		return nil
	end
	for _, gameId in body.GameIds do
		if table.find(START_PLACES, gameId) then
			return body.UserId
		end
	end
	return nil
end
 
local real = { EventType = "RightToErasureRequest", EventPayload = { UserId = 777, GameIds = { 9900, 4100 } } }
local other = { EventType = "RightToErasureRequest", EventPayload = { UserId = 777, GameIds = { 9900 } } }
local sample = { EventType = "SampleNotification", EventPayload = { UserId = 1 } }
local broken = { EventType = "RightToErasureRequest", EventPayload = { UserId = 7.5, GameIds = { 4100 } } }
 
print("real request: " .. tostring(userToErase(real)))
print("other game: " .. tostring(userToErase(other)))
print("test response: " .. tostring(userToErase(sample)))
print("bad id: " .. tostring(userToErase(broken)))
Figure 7.1. Expected output: real request: 777 other game: nil test response: nil bad id: nil

Your endpoint took 7 seconds to delete the rows, so Roblox sent the same notification again. What should the second delivery do?

  1. See the NotificationId was already handled and answer 2xx at once
  2. Delete again and answer after the work finishes
  3. Answer with an error so Roblox stops sending
  4. Ignore it without answering
Answer

See the NotificationId was already handled and answer 2xx at once. Store handled NotificationIds, answer 2xx within 5 seconds, and do slow deletions after replying. A retry then costs nothing.

Open this step in lesson mode · Link to this step · This confused me

8What you may keep, log and send

This section is not legal advice. Privacy law differs by country, and children's data gets extra protection in many places. If your game will store anything beyond gameplay data, ask a professional before you build it. What follows is what Roblox's own rules say, and what a careful team does anyway.

  • Collect only gameplay data. Beacon Yard's profile holds coins, an upgrade, a flag, a funnel step and purchase ids. Nothing in it describes the person.
  • Never ask players for personal information. Depending on their age, users may be barred from sharing or requesting email addresses, phone numbers, home addresses, full names, passwords and handles outside Roblox, so a game must not ask8.
  • No profiles for advertisers. You may not share personally identifiable engagement data with advertisers, build personalized activity profiles of users, or personalize ads for anyone under 188.
  • Logs are data too. A strike log or support note that holds a user id is personal data that an erasure request covers. Keep chat text, display names and free-form notes about a person out of logs, and delete old logs on a schedule.
  • Data you send off Roblox is still yours to delete. A round summary posted to your own server keeps the same duty: send only what you need, and delete it when an erasure request arrives4.

Which may go into Beacon Yard's support log for the lost-coins ticket?

  1. The ticket id, the user id and the revision restored
  2. Coins before and after the restore
  3. The player's email address, so you can follow up
  4. A copy of the player's chat messages from that session
Answer

The ticket id, the user id and the revision restored; Coins before and after the restore. The ticket, the user id, the revision and the coin values explain the restore, and all of them are deleted with the rest if an erasure request arrives. An email address is information a game must not request, and chat logs are personal content the ticket does not need.

Open this step in lesson mode · Link to this step · This confused me

9Which restore, when

Other ways pros do this

OptionWhat it isWhen pros pick itTrade-offs
Data Stores Manager RevertWrites an old version of the whole entry back as a new version.Simple records with one field, or a whole store you broke in one update.Puts back every field, including ProfileStore's MetaData; no merge, no live-session check.
Open Cloud restore toolA Lune or Node script that reads a revision and writes a merge.Profiles, repeat tickets, anything a second person should be able to run the same way.You must check ActiveSession, send back users and attributes, and guard the API key.
ProfileStore MessageAsyncSends a message to the profile, which the session owner handles in game code.Changes for a player who is online, such as a refund or a support grant.You write and test a handler; nothing happens until a server loads the profile.
ProfileStore VersionQuery in a serverReads past versions of a profile from Luau.An in-game admin panel that lists a player's history.Runs inside a live server, so admin checks and audit logs are on you.

Twelve lost-coins tickets arrive within an hour of an update. What does a professional team do?

  1. Treat it as an incident: check the update's save code, roll back or hotfix, then restore the affected players from the last good hour
  2. Restore each player as their ticket comes in and change nothing else
  3. Ask the players to stop reporting until the weekend
  4. Grant every player 500 coins as an apology
Answer

Treat it as an incident: check the update's save code, roll back or hotfix, then restore the affected players from the last good hour. A spike after an update is an incident. Fix the cause, then restore the affected players from the version before the update, ideally from a snapshot taken before it shipped.

Open this step in lesson mode · Link to this step · This confused me

10Build along: restore and erasure for your test experience

Use your own published test copy of Beacon Yard and your own account only. Never practise a restore on a real player's data.

Build along

m14-ship

  • challenges/work/data_ops.luau
  • tools/restore.luau
  1. Make challenges/work/data_ops.luau pass first: play, then run game.ServerScriptService.RunGameTests:Invoke("player-data-ops", "player-data-ops-tools") in the server command bar.

    You should see The player-data-ops test prints TEST PASS for all 25 checks and a pass code.

  2. Play the published test experience, collect some coins and leave. Play again in the next UTC hour and leave again. Open Configurations, Data stores manager, BeaconYard_v2, find your key, and compare the two versions.

    You should see The Data Stores Manager shows Player_ followed by your user id in BeaconYard_v2, with at least two versions to compare.

  3. In the RTBF Deletion tab, create a Standard Key template for BeaconYard_v2 with the key pattern Player_{UserId}, a Standard Key template for BeaconYard_v1 with {UserId}, and an Ordered Key template for BeaconYard_BestMatch with {UserId}, each in the global scope.

    You should see The RTBF Deletion tab lists three templates whose sample output shows your patterns with a user id in place of the token.

  4. Create an API key with only universe-datastores.versions:list, universe-datastores.objects:read and universe-datastores.objects:update on the test experience. Save the tool as tools/restore.luau, set ROBLOX_API_KEY and ROBLOX_UNIVERSE_ID, run list with your id and a time, then apply once while you are playing and once after you leave.

    You should see list prints your revisions and a revision id to restore from; apply refuses while you are in a server and restores after you leave.

Open this step in lesson mode · Link to this step · This confused me

11Challenges

Level 3, Professional

Challenge

Fix challenges/work/data_ops.luau so the restore and erasure rules in this lesson hold. The test is challenges/player-data-ops.luau and the written solution is challenges/solutions/player-data-ops.md. It touches no data store.

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("player-data-ops", "player-data-ops-tools") in the server command bar. Copy the pass code from Output.

Done means

  • pickRevision returns the newest revision strictly before the incident that is not DELETED, from a list in any order
  • restoredData keeps the higher coins, Speed if either copy owns it, legacyImported if either is true, the furthest onboarding step and every purchase id once (at most 50, newest kept), without changing its inputs
  • canWrite refuses while MetaData.ActiveSession is a table and refuses a missing entry
  • rtbfTemplates covers Player_{UserId}, {UserId} and the ordered {UserId} leaderboard; receiptRowBelongs reads PlayerId; parseErasure checks the type, the id and the start places
  • challenges/player-data-ops.luau prints TEST PASS for every check

Hints

  1. Times in the same RFC 3339 UTC format compare correctly as strings, so revisionCreateTime < incident works.
  2. Build a new purchase id list: the snapshot's ids, then the current ones, skipping any already seen, then drop from the front until 50 remain.
  3. The token is {UserId} with a capital U and a capital I.

Level 2, Builder

Challenge

Write Beacon Yard's player data runbook and data map in your copy's docs/ folder. This is a self-check; no test grades it.

Start from
The game at milestone m14 (download)

Done means

  • A one-page support runbook: how to find the key, which versions exist, when to restore, when to escalate to an incident, and what goes in the ticket log
  • A data map listing every place Beacon Yard stores data about a player (three template keys, the r_ rows, any logs or backend copies) and how each one is erased
  • An end-to-end erasure test plan on a test game with a dummy account, as the RTBF docs suggest, with the date to check the result
  • The runbook says plainly that it is not legal advice and names who on the team decides legal questions

Hints

  1. Start from the data map: list every key and row that holds a player id, then write one erase step per line.
  2. For the runbook, answer in order: how to find the key, which versions exist, when to restore, and when to open an incident.
  3. Run the erasure test on a dummy account in a test game, write down the date, and check the same keys again after that date.

Beacon Yard's erasure webhook was down for a week, and several requests were missed. The templates still ran. What is left to delete?

  1. The r_<purchaseId> rows of those users in BeaconYard_v1, found by listing keys with the r_ prefix and reading PlayerId
  2. Nothing; the templates removed everything
  3. Their profiles in BeaconYard_v2
  4. Their leaderboard rows in BeaconYard_BestMatch
Answer

The r_<purchaseId> rows of those users in BeaconYard_v1, found by listing keys with the r_ prefix and reading PlayerId. The templates cover every key named after the user. The r_ rows need the webhook or a sweep, and the daily message lists the requests you still owe.

Open this step in lesson mode · Link to this step · This confused me

12Recap

Recap

  1. A lost-coins ticket starts in the Data Stores Manager: find Player_<UserId> in BeaconYard_v2 and read its versions. Roblox keeps the last write of each UTC hour, for 30 days after it is replaced.
  2. Restore by merging, never by reverting a whole profile: higher coins, everything bought since, legacyImported kept, purchase ids kept. Refuse while MetaData.ActiveSession is set, and send back users, attributes and the etag.
  3. Deletion templates erase every key named after a user (Player_{UserId}, {UserId}, the ordered {UserId}); the r_ rows need the erasure webhook or a sweep, and the daily message is your checklist.
  4. Collect only gameplay data, never ask for personal information, keep names and chat out of logs, and get professional advice before storing more. This lesson is not legal advice.

Session lock is the vault sign-out sheet: Server A has this account, signed at 14:02, until nobody enforces the sheet; it only works because every server that touches the key checks it, and an unrenewed lock looks expired.

Next Localization: reaching other languages

Open this step in lesson mode · Link to this step · This confused me