Hi, I wanted to redo a saving system in a kit my friend uses, but when saving, it says it can’t store dictionaries into datastores. This would be fine, if It didn’t work at all. I was planning on doing a loop at first, that saved every 2 minutes before i get everything set up, to which it saved the first time, but errored the second. Her is the code, and what it saved the first time using datastore editor.
_G.SaveV2 = function(player)
local service = game:GetService("Players")
local id = service:GetUserIdFromNameAsync(player.Name)
local ds = game:GetService("DataStoreService"):GetDataStore("BermudaSaveSystem")
local save = ds:GetAsync("Data_"..id)
local weapons = {}
local souls = {}
local statss = {}
local armor = {}
local food = {}
local Statistics = {
["Weapons"] = weapons,
["Souls"] = souls,
["Stats"] = statss,
["Armors"] = armor,
["Food"] = food,
}
table.clear(weapons)
table.clear(souls)
table.clear(statss)
table.clear(armor)
table.clear(food)
for i,v in ipairs(player:GetChildren()) do
if not v:IsA("Folder") and not v:IsA("PlayerGui") and not v:IsA("PlayerScripts") and v.Name ~= "_loadeddata" and not v:IsA("Backpack") and not v:IsA("StarterGear") and v.Name ~= "Pos" and v.Name ~= "TextColor" then
table.insert(statss,{v.Name,v.Value})
end
end
for i,v in ipairs(player:WaitForChild("Weapons",10):GetChildren()) do
table.insert(weapons,{v.Name,v.Value})
end
for i,v in ipairs(player:WaitForChild("SOULs",10):GetChildren()) do
table.insert(souls,{v.Name,v.Value})
end
for i,v in ipairs(player:WaitForChild("Food",10):GetChildren()) do
table.insert(food,{v.Name,v.Value})
end
for i,v in ipairs(player:WaitForChild("Armor",10):GetChildren()) do
table.insert(armor,{v.Name,v.Value})
end
ds:SetAsync("Data_"..id,Statistics)
end