I want to transfer the data from 1 game to another entirely different game
I am trying to get all the data from the data store by using a for loop but it gives this error:
local Players = game:GetService("Players")
local DS = game:GetService("DataStoreService")
local DataBase = DS:GetDataStore("PlayerData")
local HttpService = game:GetService("HttpService")
local function pagesToTable(pages)
local items = {}
local pageIndex = 1
while true do
for i,v in pairs(pages:GetCurrentPage()) do
local name = v.KeyName
pcall(function()
items[name] = DataBase:GetAsync(name)
print(name)
end)
end
print("Added page", pageIndex)
pageIndex += 1
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
end
return items
end
print(game:GetService("HttpService"):JSONEncode(pagesToTable(DataBase:ListKeysAsync())))