I am creating an admin system and would like to access an offline player’s data, I am using DS2. The code below is modified from the DS2 thread that @Kampfkarren made for GDPR however it used GetAsync
instead of RemoveAsync
which according to the API take the same inputs, however it just outputs an empty table.
local DataStoreService = game:GetService("DataStoreService")
function getData(userId, name)
local orderedDataStore = DataStoreService:GetOrderedDataStore(name .. "/" .. userId)
local dataStore = DataStoreService:GetDataStore(name .. "/" .. userId)
while true do
local pages = orderedDataStore:GetSortedAsync(false, 100)
local data = pages:GetCurrentPage()
for _, pair in pairs(data) do
print(("key: %d"):format(pair.key))
print(dataStore:GetAsync(pair.key))
orderedDataStore:GetAsync(pair.key)
end
if pages.IsFinished then
print(("finished (%d: %s)"):format(userId, name))
return
end
end
end
print(getData(88965785, "DATA"))
I have also tried using the code from this thread, however like above data
is an empty table thus it errors. I have some other attempts like editing the source to no success and trying to create a fake player that I saw suggested on the DS2 thread.
The reason I don’t want to save the player’s ban status in a separate DataStore is because I would also like access to all of the players data, money, exp etc.