Edit options

Settings and the two functions that let your game decide.

Preview
On this page

Options

urlstringRequired

Atomo’s address for games: https://api.useatomo.com.

keySecret | stringRequired

The edit key, from HttpService:GetSecret("atomo_edit").

scopestringDefault "global"

The data store’s scope. Edits of another scope are left for another server.

allowfunction(store, key, edit): boolean

Asked before each edit is applied. Return true to let it through; anything else refuses it, and the dashboard says Refused by the game. It must not wait: an error or a yield refuses the edit too. Not asked for Save now.

changedfunction(store, key, edit)

Told after an edit is applied, before the save: put right anything that keeps a copy of the data, such as leaderstats. Runs in a thread of its own; its errors are your game’s. Not told for direct.

studiobooleanDefault false

true works in Studio as well.

quietbooleanDefault false

true says nothing in the output.

What your functions are given

edit
{
    id = "3fa85f6457174562",
    kind = "update", -- or "restore", or "save" for Save now
    changes = {
        { path = { "Coins" }, before = 120, after = 500 },
        { path = { "Bag", 2, "Name" }, before = "Torch", after = "Lantern" },
    },
}

A copy: changing it changes nothing. Paths are counted from 1 in lists, as in Luau, from the data path down.

Examples

Let edits through only when it is safe, and keep leaderstats right
AtomoEdits.start({
    url = "https://api.useatomo.com",
    key = if found then secret else nil,
    allow = function(store, key, edit)
        -- Never while the player is trading.
        return not Trading.isBusy(key)
    end,
    changed = function(store, key, edit)
        local player = playerOfKey(key)
        if player then
            player.leaderstats.Coins.Value = sessions[key].Coins
        end
    end,
})

Limits

WhatLimit
Requests6 a minute at most from each server, one at a time, and one more as it closes. None while it holds nobody and has nothing to tell.
WaitingA request may be held open up to 20 seconds, so an edit arrives at once.
One playerOne edit at a time.
Your save budgetEdits apply only while the game has more than 10 writes of its data store budget to spare; otherwise they wait.
SizeAn edit that would take a held table’s save over 4 MB is refused.

What it never does

  • Run anything Atomo sends. An edit is paths and values.
  • Edit a table with a metatable, anything inside one, or a frozen table.
  • Make a gap in a list, or a table that is both a list and fields.
  • Print a key or a player’s data.
  • Write to a data store, but for direct: one UpdateAsync for each edit.

Messages

Through warn, starting AtomoEdits:, once a server or once in 10 minutes:

MessageMeans
start needs the edit key. No edit is applied.No key: check the secret atomo_edit.
start needs an https address. No edit is applied.Fix url.
allow and changed are functions. No edit is applied.One of them was given something else.
a data store's scope isn't one. No edit is applied.Fix scope.
start's settings can't be read. No edit is applied.start wasn’t given a table.
a part of it is missing. No edit is applied.Core isn’t inside AtomoEdits: insert the file again.
a player was held before start.A player was held before start: call it first.
allow errored or yielded, so an edit was refused.allow must return at once.
HTTP requests are off in this experience's security settings.Allow HTTP requests, and publish.
the key isn't right, or was removed.Put a working edit key in the secret.
Atomo can't be reached. Edits wait.It keeps trying. Edits wait in Atomo, up to 30 days.
the address is wrong, or it can't answer (404).Check url.
it only works on the server.It was required from a client.
it does nothing inside an Actor.Keep it in ServerStorage.
start was already called.Start it once.