I am trying to view someone’s data from a older date. But it throws me an error from profileService
Here is the documentation code I tried using: API - ProfileService
-- Get a ProfileStore object with the same arguments you passed to the
-- ProfileStore that loads player Profiles. It can also just be
-- the very same ProfileStore object:
local profileService = require(game:WaitForChild("ServerStorage"):WaitForChild("Modules"):WaitForChild("ProfileService"))
local DataName = "roblox#007"
local ExampleProfile = {
EarnedMoney = 0;
Money = 0;
Rebirth = 0;
TimePlayed = 0;
Builds = {};
CashCollect = 0;
GroupReward = false;
UsedCodes = {
};
Settings = {
Music = true;
--Volume = 1;
SFX = true;
Animations = true;
Beams = true;
};
}
local ProfileStore = profileService.GetProfileStore(DataName, ExampleProfile)
-- If you can't figure out the exact time and timezone the player lost rubies
-- in on the day of August 14th, then your best bet is to try querying
-- UTC August 13th. If the first entry still doesn't have the rubies -
-- try a new query of UTC August 12th and etc.
local max_date = DateTime.fromUniversalTime(2022, 04, 13) -- UTC August 13th, 2021
print(ProfileStore)
local query = ProfileStore:ProfileVersionQuery(
"Player_123123", -- The same profile key that gets passed to :LoadProfileAsync()
Enum.SortDirection.Descending,
nil,
max_date
)
print(query)
-- Get the first result in the query:
local profile = query:NextAsync()
if profile ~= nil then
profile:ClearGlobalUpdates()
profile:OverwriteAsync() -- This method does the actual rolling back;
-- Don't call this method until you're sure about setting the latest
-- version to a copy of the previous one
print("Rollback success!")
print(profile.Data) -- You'll be able to surf table contents if
-- you're runing this code in studio with access to API services
-- enabled and have expressive output enabled; If the printed
-- data doesn't have the rubies, you'll want to change your
-- query parameters.
else
print("No version to rollback to")
end