So, basicaly ive been trying to get all the keys from my datastore, I wanna retrieve them and convert the keys into a JSON, however, when I try and wait for the keys to be retrieved, after a few minutes this appears in the output:
I tried making that if the throttle happens error happens, it will wait an additional 30 seconds so the request can chill, but after the first time the error pops in, it keeps appearing after a few times:
If anybody knows how to fix this, or knows an alternate way to do what Im trying to, please let me know
, Thanks.
- heres the lines of code:
local HttpService = game:GetService("HttpService")
local DataStoreService = game:GetService("DataStoreService")
local TheDataStore = DataStoreService:GetDataStore("mydatastorehereignorehaha")
local AllDataStoreKeys = {}
local startTime = tick()
local Success, Pages = pcall(function()
return TheDataStore:ListKeysAsync()
end)
if not Success then
warn("Failed to list keys: " .. tostring(Pages))
return
end
local pgc = 0
while task.wait() do
local Items = Pages:GetCurrentPage()
for _, Data in ipairs(Items) do
table.insert(AllDataStoreKeys, Data.KeyName)
if tick() - startTime >= 1 then
print("PROGRESS: " .. #AllDataStoreKeys .. " KEYS")
startTime = tick()
end
end
pgc = pgc + 1
print("pgc: ", pgc)
task.wait(3)
local success, err = pcall(function()
Pages:AdvanceToNextPageAsync()
end)
if not success then
warn("30 secs CD" .. tostring(err))
task.wait(30.5)
else
--// finished
if Pages.IsFinished then break end
end
end
local JSON = HttpService:JSONEncode(AllDataStoreKeys)
print(JSON)

