The edits module
Install AtomoEdits and tell it which players each server holds.
Install it
Download it, and insert it into ServerStorage
AtomoEdits.rbxmxModuleScript AtomoEdits, with Core inside · 45 KBDownloadRight-click ServerStorage, Insert from File. It adds
AtomoEdits, withCoreinside it, besideAtomo.Keep an edit key in a secret
In the game’s Settings, under Edit key, press Make an edit key. It is shown once. In the Creator Dashboard, keep it in the experience’s Secrets as
atomo_edit, withapi.useatomo.comas its domain.Start it, once
Server script local HttpService = game:GetService("HttpService") local ServerStorage = game:GetService("ServerStorage") local AtomoEdits = require(ServerStorage.AtomoEdits) local found, secret = pcall(function() return HttpService:GetSecret("atomo_edit") end) AtomoEdits.start({ url = "https://api.useatomo.com", key = if found then secret else nil, })HTTP requests must be allowed, as for reporting. To try it in Studio, add
studio = trueand the key as a local secret.Tell it which players this server holds
In the way your game saves:
-- Your game keeps the player's data in a table, and saves it with UpdateAsync. AtomoEdits.held("PlayerData", key, sessionData, function() local ok, _, info = pcall(function() return store:UpdateAsync(key, function() return sessionData end) end) return ok, info end) -- When the player leaves, after your last save: AtomoEdits.released("PlayerData", key)local profile = PlayerStore:StartSessionAsync(key) if profile then AtomoEdits.profile("PlayerData", profile) end-- Your game keeps nothing in memory, and changes the store with UpdateAsync each time. AtomoEdits.direct("PlayerData", key, store) -- When the player leaves: AtomoEdits.released("PlayerData", key)
The calls
| Call | When |
|---|---|
AtomoEdits.start(options) | Once, on the server. Options |
AtomoEdits.profile(store, profile) | ProfileStore: once a session has started. |
AtomoEdits.held(store, key, data, save) | Your own table: once it is loaded. |
AtomoEdits.direct(store, key, dataStore) | A plain data store your game writes straight: when the player joins. |
AtomoEdits.released(store, key) | After the last save of a held or direct player. |
AtomoEdits.saved(store, key, data, info) | Optional: after each save of a held table. |
None of them errors, waits or gives anything back, whatever it is given.
ProfileStore
With Data as the data path in Atomo, only Data is edited. The module saves with profile:Save(), and tells Atomo the edit was applied once OnAfterSave holds it. The player is held until their session ends.
Your own table
Give the player’s data as Atomo shows it (at the data path), and a function that saves it now, giving back true once it is stored, and the key info if it has it. If that save fails, the module tries it twice more, 30 seconds apart; or call saved after each of your own saves, and they tell it instead. A table that is there is changed in place, so a part your code keeps (local bag = data.Bag) is still the player’s.
Written straight
For a game that keeps nothing in memory between saves. The module writes the edit itself, with one UpdateAsync, while the player is in this server. It keeps the key’s user IDs and metadata.
With the reporting module
The two run side by side, each with its own key. An applied edit reaches Atomo’s copy through your save, which the reporting module reports as any other.