Hello!
I was working on a huge data store system that saves CFrames and values. When I try to run the DataStore this happens:
What It prints:
["Borders"] = {},
["Rocks"] = {},
["Trees"] = {}
What I want it to print:
["Borders"] = ▼ {
["BorderChunk 1010"] = BorderChunks5,
["BorderChunk 11"] = BorderChunks2,
["BorderChunk 110"] = BorderChunks2,
["BorderChunk 1110"] = BorderChunks5,
["BorderChunk 12"] = BorderChunks2,
["BorderChunk 1210"] = BorderChunks3,
["BorderChunk 13"] = BorderChunks4,
["BorderChunk 1310"] = BorderChunks6,
["BorderChunk 14"] = BorderChunks3,
["BorderChunk 1410"] = BorderChunks1,
["BorderChunk 15"] = BorderChunks6,
["BorderChunk 1510"] = BorderChunks5,
["BorderChunk 16"] = BorderChunks2,
["BorderChunk 1610"] = BorderChunks1,
["BorderChunk 17"] = BorderChunks1,
["BorderChunk 1710"] = BorderChunks3,
["BorderChunk 18"] = BorderChunks4,
["BorderChunk 1810"] = BorderChunks4,
["BorderChunk 19"] = BorderChunks2,
["BorderChunk 1910"] = BorderChunks6,
["BorderChunk 2010"] = BorderChunks5,
["BorderChunk 210"] = BorderChunks4,
["BorderChunk 2110"] = BorderChunks6,
["BorderChunk 2210"] = BorderChunks6,
["BorderChunk 2310"] = BorderChunks4,
["BorderChunk 2410"] = BorderChunks5,
["BorderChunk 2510"] = BorderChunks4,
["BorderChunk 2610"] = BorderChunks5,
["BorderChunk 2710"] = BorderChunks5,
["BorderChunk 2810"] = BorderChunks1,
["BorderChunk 2910"] = BorderChunks4,
["BorderChunk 3010"] = BorderChunks6,
["BorderChunk 310"] = BorderChunks6,
["BorderChunk 3110"] = BorderChunks6,
["BorderChunk 3210"] = BorderChunks3,
["BorderChunk 3310"] = BorderChunks6,
["BorderChunk 3410"] = BorderChunks3,
["BorderChunk 3510"] = BorderChunks6,
["BorderChunk 3610"] = BorderChunks1,
["BorderChunk 3710"] = BorderChunks1,
["BorderChunk 3810"] = BorderChunks3,
["BorderChunk 3910"] = BorderChunks4,
["BorderChunk 4010"] = BorderChunks6,
["BorderChunk 410"] = BorderChunks4,
["BorderChunk 4110"] = BorderChunks2,
["BorderChunk 4210"] = BorderChunks3,
["BorderChunk 4310"] = BorderChunks4,
["BorderChunk 4410"] = BorderChunks1,
["BorderChunk 4510"] = BorderChunks4,
["BorderChunk 4610"] = BorderChunks6,
["BorderChunk 4710"] = BorderChunks5,
["BorderChunk 4810"] = BorderChunks4,
["BorderChunk 4910"] = BorderChunks1,
["BorderChunk 501"] = BorderChunks1,
["BorderChunk 5010"] = BorderChunks6,
["BorderChunk 502"] = BorderChunks5,
["BorderChunk 503"] = BorderChunks5,
["BorderChunk 504"] = BorderChunks6,
["BorderChunk 505"] = BorderChunks2,
["BorderChunk 506"] = BorderChunks6,
["BorderChunk 507"] = BorderChunks4,
["BorderChunk 508"] = BorderChunks5,
["BorderChunk 509"] = BorderChunks1,
["BorderChunk 510"] = BorderChunks2,
["BorderChunk 610"] = BorderChunks3,
["BorderChunk 710"] = BorderChunks2,
["BorderChunk 810"] = BorderChunks5,
["BorderChunk 910"] = BorderChunks4
},
["Rocks"] = ▼ {
["Chunk 1041"] = ▶ {...},
["Chunk 1143"] = ▶ {...},
["Chunk 1146"] = ▶ {...},
["Chunk 122"] = ▶ {...},
["Chunk 123"] = ▶ {...},
["Chunk 1232"] = ▶ {...},
["Chunk 1345"] = ▶ {...},
["Chunk 1443"] = ▶ {...},
["Chunk 1448"] = ▶ {...},
["Chunk 147"] = ▶ {...},
["Chunk 151"] = ▶ {...},
["Chunk 1535"] = ▶ {...},
["Chunk 156"] = ▶ {...},
["Chunk 166"] = ▶ {...},
["Chunk 1738"] = ▶ {...},
["Chunk 188"] = ▶ {...},
["Chunk 1911"] = ▶ {...},
["Chunk 1913"] = ▶ {...},
["Chunk 2014"] = ▶ {...},
["Chunk 2116"] = ▶ {...},
["Chunk 229"] = ▶ {...},
["Chunk 2333"] = ▶ {...},
["Chunk 2334"] = ▶ {...},
["Chunk 258"] = ▶ {...},
["Chunk 2832"] = ▶ {...},
["Chunk 2930"] = ▶ {...},
["Chunk 3020"] = ▶ {...},
["Chunk 3110"] = ▶ {...},
["Chunk 3117"] = ▶ {...},
["Chunk 3124"] = ▶ {...},
["Chunk 3135"] = ▶ {...},
["Chunk 3215"] = ▶ {...},
["Chunk 324"] = ▶ {...},
["Chunk 330"] = ▶ {...},
["Chunk 341"] = ▶ {...},
["Chunk 3427"] = ▶ {...},
["Chunk 3428"] = ▶ {...},
["Chunk 3518"] = ▶ {...},
["Chunk 3520"] = ▶ {...},
["Chunk 3537"] = ▶ {...},
["Chunk 3612"] = ▶ {...},
["Chunk 3633"] = ▶ {...},
["Chunk 3726"] = ▶ {...},
["Chunk 3728"] = ▶ {...},
["Chunk 3735"] = ▶ {...},
["Chunk 377"] = ▶ {...},
["Chunk 3831"] = ▶ {...},
["Chunk 406"] = ▶ {...},
["Chunk 4237"] = ▶ {...},
["Chunk 4550"] = ▶ {...},
["Chunk 4936"] = ▶ {...},
["Chunk 505"] = ▶ {...},
["Chunk 529"] = ▶ {...},
["Chunk 535"] = ▶ {...},
["Chunk 547"] = ▶ {...},
["Chunk 550"] = ▶ {...},
["Chunk 840"] = ▶ {...}
},
["Trees"] = ▼ {
["Chunk 1033"] = ▶ {...},
["Chunk 1048"] = ▶ {...},
["Chunk 1133"] = ▶ {...},
["Chunk 1135"] = ▶ {...},
["Chunk 1136"] = ▶ {...},
["Chunk 1137"] = ▶ {...},
["Chunk 1149"] = ▶ {...},
["Chunk 1210"] = ▶ {...},
["Chunk 1234"] = ▶ {...},
["Chunk 124"] = ▶ {...},
["Chunk 1246"] = ▶ {...},
["Chunk 1247"] = ▶ {...},
["Chunk 125"] = ▶ {...},
["Chunk 126"] = ▶ {...},
["Chunk 127"] = ▶ {...},
["Chunk 1310"] = ▶ {...},
["Chunk 1312"] = ▶ {...},
["Chunk 133"] = ▶ {...},
["Chunk 1330"] = ▶ {...},
["Chunk 1334"] = ▶ {...},
["Chunk 1336"] = ▶ {...},
["Chunk 1340"] = ▶ {...},
["Chunk 1344"] = ▶ {...},
["Chunk 1346"] = ▶ {...},
["Chunk 135"] = ▶ {...},
["Chunk 136"] = ▶ {...},
["Chunk 139"] = ▶ {...},
["Chunk 1411"] = ▶ {...},
["Chunk 1413"] = ▶ {...},
["Chunk 1415"] = ▶ {...},
["Chunk 143"] = ▶ {...},
["Chunk 1431"] = ▶ {...},
["Chunk 1434"] = ▶ {...},
["Chunk 1435"] = ▶ {...},
["Chunk 144"] = ▶ {...},
["Chunk 1444"] = ▶ {...},
["Chunk 1446"] = ▶ {...},
["Chunk 1510"] = ▶ {...},
["Chunk 1512"] = ▶ {...},
["Chunk 152"] = ▶ {...},
["Chunk 1538"] = ▶ {...},
["Chunk 1540"] = ▶ {...},
["Chunk 1544"] = ▶ {...},
["Chunk 155"] = ▶ {...},
["Chunk 158"] = ▶ {...},
["Chunk 1611"] = ▶ {...},
["Chunk 1613"] = ▶ {...},
["Chunk 1615"] = ▶ {...},
["Chunk 1632"] = ▶ {...},
["Chunk 1635"] = ▶ {...},
["Chunk 1639"] = ▶ {...},
["Chunk 164"] = ▶ {...},
["Chunk 1641"] = ▶ {...},
["Chunk 1643"] = ▶ {...},
["Chunk 1645"] = ▶ {...},
["Chunk 169"] = ▶ {...},
["Chunk 1734"] = ▶ {...},
["Chunk 1740"] = ▶ {...},
["Chunk 1741"] = ▶ {...},
["Chunk 1742"] = ▶ {...},
["Chunk 177"] = ▶ {...},
["Chunk 1810"] = ▶ {...},
["Chunk 1836"] = ▶ {...},
["Chunk 1838"] = ▶ {...},
["Chunk 189"] = ▶ {...},
["Chunk 1912"] = ▶ {...},
["Chunk 1915"] = ▶ {...},
["Chunk 1933"] = ▶ {...},
["Chunk 1934"] = ▶ {...},
["Chunk 1937"] = ▶ {...},
["Chunk 2012"] = ▶ {...},
["Chunk 2017"] = ▶ {...},
["Chunk 202"] = ▶ {...},
["Chunk 2034"] = ▶ {...},
["Chunk 2035"] = ▶ {...},
["Chunk 2038"] = ▶ {...},
["Chunk 208"] = ▶ {...},
["Chunk 2117"] = ▶ {...},
["Chunk 2134"] = ▶ {...},
["Chunk 2210"] = ▶ {...},
["Chunk 2212"] = ▶ {...},
["Chunk 2217"] = ▶ {...},
["Chunk 222"] = ▶ {...},
["Chunk 228"] = ▶ {...},
["Chunk 229"] = ▶ {...},
["Chunk 2314"] = ▶ {...},
["Chunk 2318"] = ▶ {...},
["Chunk 2319"] = ▶ {...},
["Chunk 240"] = ▶ {...},
["Chunk 241"] = ▶ {...},
["Chunk 2411"] = ▶ {...},
["Chunk 2415"] = ▶ {...},
["Chunk 246"] = ▶ {...},
["Chunk 248"] = ▶ {...},
["Chunk 249"] = ▶ {...},
["Chunk 2512"] = ▶ {...},
["Chunk 253"] = ▶ {...},
["Chunk 255"] = ▶ {...},
["Chunk 259"] = ▶ {...},
["Chunk 2611"] = ▶ {...},
["Chunk 2619"] = ▶ {...},
["Chunk 267"] = ▶ {...},
["Chunk 2717"] = ▶ {...},
["Chunk 2719"] = ▶ {...},
["Chunk 2720"] = ▶ {...},
["Chunk 276"] = ▶ {...},
["Chunk 2813"] = ▶ {...},
["Chunk 2814"] = ▶ {...},
["Chunk 2816"] = ▶ {...},
["Chunk 2819"] = ▶ {...},
["Chunk 286"] = ▶ {...},
["Chunk 288"] = ▶ {...},
["Chunk 2922"] = ▶ {...},
["Chunk 2929"] = ▶ {...},
["Chunk 2931"] = ▶ {...},
["Chunk 2936"] = ▶ {...},
["Chunk 2937"] = ▶ {...},
["Chunk 3010"] = ▶ {...},
["Chunk 3016"] = ▶ {...},
["Chunk 3021"] = ▶ {...},
["Chunk 3022"] = ▶ {...},
["Chunk 3033"] = ▶ {...},
["Chunk 307"] = ▶ {...},
["Chunk 3113"] = ▶ {...},
["Chunk 3114"] = ▶ {...},
["Chunk 3118"] = ▶ {...},
["Chunk 3121"] = ▶ {...},
["Chunk 3123"] = ▶ {...},
["Chunk 3129"] = ▶ {...},
["Chunk 3138"] = ▶ {...},
["Chunk 3216"] = ▶ {...},
["Chunk 3217"] = ▶ {...},
["Chunk 3218"] = ▶ {...},
["Chunk 3220"] = ▶ {...},
["Chunk 3226"] = ▶ {...},
["Chunk 3229"] = ▶ {...},
["Chunk 3230"] = ▶ {...},
["Chunk 3240"] = ▶ {...},
["Chunk 3310"] = ▶ {...},
["Chunk 3312"] = ▶ {...},
["Chunk 3316"] = ▶ {...},
["Chunk 3321"] = ▶ {...},
["Chunk 3323"] = ▶ {...},
["Chunk 3324"] = ▶ {...},
["Chunk 3325"] = ▶ {...},
["Chunk 3326"] = ▶ {...},
["Chunk 3332"] = ▶ {...},
["Chunk 3337"] = ▶ {...},
["Chunk 3339"] = ▶ {...},
["Chunk 3340"] = ▶ {...},
["Chunk 337"] = ▶ {...},
["Chunk 338"] = ▶ {...},
["Chunk 3410"] = ▶ {...},
["Chunk 3418"] = ▶ {...},
["Chunk 3429"] = ▶ {...},
["Chunk 3437"] = ▶ {...},
["Chunk 3438"] = ▶ {...},
["Chunk 3439"] = ▶ {...},
["Chunk 347"] = ▶ {...},
["Chunk 3514"] = ▶ {...},
["Chunk 3519"] = ▶ {...},
["Chunk 3521"] = ▶ {...},
["Chunk 3523"] = ▶ {...},
["Chunk 3524"] = ▶ {...},
["Chunk 3535"] = ▶ {...},
["Chunk 3539"] = ▶ {...},
["Chunk 3610"] = ▶ {...},
["Chunk 3613"] = ▶ {...},
["Chunk 3619"] = ▶ {...},
["Chunk 3620"] = ▶ {...},
["Chunk 3622"] = ▶ {...},
["Chunk 3632"] = ▶ {...},
["Chunk 3636"] = ▶ {...},
["Chunk 368"] = ▶ {...},
["Chunk 3715"] = ▶ {...},
["Chunk 3717"] = ▶ {...},
["Chunk 3719"] = ▶ {...},
["Chunk 3720"] = ▶ {...},
["Chunk 3730"] = ▶ {...},
["Chunk 3733"] = ▶ {...},
["Chunk 3738"] = ▶ {...},
["Chunk 3740"] = ▶ {...},
["Chunk 3817"] = ▶ {...},
["Chunk 3818"] = ▶ {...},
["Chunk 3820"] = ▶ {...},
["Chunk 3830"] = ▶ {...},
["Chunk 3834"] = ▶ {...},
["Chunk 3835"] = ▶ {...},
["Chunk 3839"] = ▶ {...},
["Chunk 387"] = ▶ {...},
["Chunk 3913"] = ▶ {...},
["Chunk 3931"] = ▶ {...},
["Chunk 3934"] = ▶ {...},
["Chunk 3936"] = ▶ {...},
["Chunk 3937"] = ▶ {...},
["Chunk 3938"] = ▶ {...},
["Chunk 397"] = ▶ {...},
["Chunk 399"] = ▶ {...},
["Chunk 4010"] = ▶ {...},
["Chunk 4011"] = ▶ {...},
["Chunk 4032"] = ▶ {...},
["Chunk 4033"] = ▶ {...},
["Chunk 405"] = ▶ {...},
["Chunk 4111"] = ▶ {...},
["Chunk 4112"] = ▶ {...},
["Chunk 4114"] = ▶ {...},
["Chunk 4135"] = ▶ {...},
["Chunk 4136"] = ▶ {...},
["Chunk 421"] = ▶ {...},
["Chunk 4215"] = ▶ {...},
["Chunk 4311"] = ▶ {...},
["Chunk 435"] = ▶ {...},
["Chunk 436"] = ▶ {...},
["Chunk 439"] = ▶ {...},
["Chunk 4411"] = ▶ {...},
["Chunk 4414"] = ▶ {...},
["Chunk 443"] = ▶ {...},
["Chunk 444"] = ▶ {...},
["Chunk 447"] = ▶ {...},
["Chunk 448"] = ▶ {...},
["Chunk 449"] = ▶ {...},
["Chunk 450"] = ▶ {...},
["Chunk 4512"] = ▶ {...},
["Chunk 453"] = ▶ {...},
["Chunk 456"] = ▶ {...},
["Chunk 457"] = ▶ {...},
["Chunk 458"] = ▶ {...},
["Chunk 461"] = ▶ {...},
["Chunk 467"] = ▶ {...},
["Chunk 468"] = ▶ {...},
["Chunk 4711"] = ▶ {...},
["Chunk 4712"] = ▶ {...},
["Chunk 475"] = ▶ {...},
["Chunk 476"] = ▶ {...},
["Chunk 478"] = ▶ {...},
["Chunk 479"] = ▶ {...},
["Chunk 491"] = ▶ {...},
["Chunk 492"] = ▶ {...},
["Chunk 496"] = ▶ {...},
["Chunk 5010"] = ▶ {...},
["Chunk 5034"] = ▶ {...},
["Chunk 5035"] = ▶ {...},
["Chunk 508"] = ▶ {...},
["Chunk 544"] = ▶ {...},
["Chunk 546"] = ▶ {...},
["Chunk 548"] = ▶ {...},
["Chunk 636"] = ▶ {...},
["Chunk 637"] = ▶ {...},
["Chunk 638"] = ▶ {...},
["Chunk 640"] = ▶ {...},
["Chunk 641"] = ▶ {...},
["Chunk 642"] = ▶ {...},
["Chunk 643"] = ▶ {...},
["Chunk 644"] = ▶ {...},
["Chunk 649"] = ▶ {...},
["Chunk 650"] = ▶ {...},
["Chunk 733"] = ▶ {...},
["Chunk 743"] = ▶ {...},
["Chunk 744"] = ▶ {...},
["Chunk 747"] = ▶ {...},
["Chunk 750"] = ▶ {...},
["Chunk 831"] = ▶ {...},
["Chunk 930"] = ▶ {...},
["Chunk 931"] = ▶ {...},
["Chunk 932"] = ▶ {...},
["Chunk 937"] = ▶ {...},
["Chunk 939"] = ▶ {...},
["Chunk 942"] = ▶ {...},
["Chunk 944"] = ▶ {...},
["Chunk 948"] = ▶ {...},
["Chunk 950"] = ▶ {...}
}
The script:
function module:LoadGameData(newMap)
local GameData = require(game:GetService("ServerScriptService").Modules.GameData)
local DataStore = game:GetService("DataStoreService"):GetDataStore(GameData.ServerCode)
local Players = game:GetService("Players")
local Http = game:GetService("HttpService")
local tries = 3
local Resources, Objects
local succ, err
local function Get()
local count = 0
repeat
succ, err = pcall(function()
Resources = DataStore:GetAsync("Resources")
if newMap == false then
Objects = DataStore:GetAsync("Objects")
end
end)
count += 1
until count >= tries or succ
if not succ then
warn("Failed to load Server:"..GameData.ServerCode.." kicking all players...")
warn(err)
for i, v in pairs(Players:GetPlayers()) do
v:Kick("\n\n Failed to load Server. kicking all players - Rejoin to load back. \n\n")
end
return
end
if succ then
if newMap == false then
if Resources and Objects then
return {
["Wood"] = Resources.Wood,
["Iron"] = Resources.Iron,
["CitizenCount"] = Resources.CitizenCount,
["Coal"] = Resources.Coal,
["Gold"] = Resources.Gold,
["Food"] = Resources.Food,
["Water"] = Resources.Water,
["Stone"] = Resources.Stone,
["Objects"] = Objects,
}
else
return {
["Wood"] = GameData.Wood,
["Iron"] = GameData.Iron,
["CitizenCount"] = GameData.CitizenCount,
["Coal"] = GameData.Coal,
["Gold"] = GameData.Gold,
["Food"] = GameData.Food,
["Water"] = GameData.Water,
["Stone"] = GameData.Stone,
["Objects"] = GameData.Objects,
}
end
else
if Resources then
return {
["Wood"] = Resources.Wood,
["Iron"] = Resources.Iron,
["CitizenCount"] = Resources.CitizenCount,
["Coal"] = Resources.Coal,
["Gold"] = Resources.Gold,
["Food"] = Resources.Food,
["Water"] = Resources.Water,
["Stone"] = Resources.Stone,
}
else
return {
["Wood"] = GameData.Wood,
["Iron"] = GameData.Iron,
["CitizenCount"] = GameData.CitizenCount,
["Coal"] = GameData.Coal,
["Gold"] = GameData.Gold,
["Food"] = GameData.Food,
["Water"] = GameData.Water,
["Stone"] = GameData.Stone,
}
end
end
end
end
local function Set()
local Values = Get()
local count = 0
local succ, err
local Resources = {
["Wood"] = GameData.Wood,
["Iron"] = GameData.Iron,
["CitizenCount"] = GameData.CitizenCount,
["Coal"] = GameData.Coal,
["Gold"] = GameData.Gold,
["Food"] = GameData.Food,
["Water"] = GameData.Water,
["Stone"] = GameData.Stone,
}
Resources.Wood = Values.Wood
Resources.Iron = Values.Iron
Resources.CitizenCount = Values.CitizenCount
Resources.Coal = Values.Coal
Resources.Gold = Values.Gold
Resources.Food = Values.Food
Resources.Water = Values.Water
Resources.Stone = Values.Stone
if newMap == false then
print(Objects)
GameData.Objects = Objects
end
print(GameData.Objects)
repeat
succ, err = pcall(function()
--DataStore:SetAsync("Resources", Resources)
if newMap == true then
DataStore:SetAsync("Objects", GameData.Objects)
end
end)
count += 1
until count >= tries or succ
if not succ then
warn("Failed to Set Server:"..GameData.ServerCode)
warn(err)
return
end
warn("\n\n Game Data Has Loaded or Been Set! No Errors At All! Woohoo! \n\n")
Set()
end