Hi Creators!
This is a follow-up to the Upcoming Changes to Data Stores Versioning announcement. Methods to retrieve data store versions by timestamp are now live in Engine and Open Cloud. As a reminder, the other announced changes went live earlier this year.
These methods make it easier to use Data Stores versions for data rollback to a particular time. For example, if a bad update was published on 12/2/2024 at 6:05 UTC, you can use the following code to retrieve a past version of a key prior to the update:
local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("DataStore")
local key = "key-123"
local timestamp = DateTime.fromUniversalTime(2024, 12, 02, 06, 04, 59)
local success, result, keyInfo = pcall(function()
return dataStore:GetVersionAtTimeAsync(key, timestamp.UnixTimestampMillis)
end)
if success then
if result == nil then
print("No version found at time")
else
print("Data before update was", result, keyInfo.Version)
end
else
warn(result)
end
And, you can access the same previous version with the following Open Cloud resource URL:
https://apis.roblox.com/cloud/v2/universes/{universe}/data-stores/DataStore/entries/key-123@latest:2024-12-02T06:04:59Z
Previously, you had to use a combination of DataStore:ListVersionsAsync() and DataStore:GetVersionAsync() to achieve the same result.
To get started, check out the Engine API documentation for DataStore:GetVersionAtTimeAsync() and the updated Open Cloud API documentation for Get Data Store Entry.
As always, please let us know if you have any questions or encounter any issues!
The Data Stores team