Datastore2 issue

Hello! I have been communicating on the official datastore 2 page but i wanted to see if anyone else had anything else to contribute to my issue here.

image

For some reason Datastore 2 is no longer saving my dictionaries… they were doing it before… but i have no idea what has changed. I’ve also been playing with the API for Datastore2.Combine(MasterKey, other keys) But ever since then i have been having issues with errors like this… i have even undone the combine function and they are still happening. Anyone have any thoughts?

Hi, would you mind sharing the data structure of what you’re saving? That could help us figure out what’s wrong (code is also much appreciated). Also, based on the errors it seems like it’s not updating because the data has not been altered.

Ok, but its a lot… note i am using Aero Framework aswell so the start function happens when the game starts.

    --Character Store---------------------------------------------------------------------------------------------------------- 

function TROA_DATASTORE_SERVICE:Character_Store(Player)
local CharInfoStore = DataStore2("CharInfoStore"..key, Player)
local CurrentTime = os.time()
local CharacterStats = Instance.new("Folder")
CharacterStats.Name = "CharacterStats"
CharacterStats.Parent = Player

local InitialDictionary = {
	"CharName",
	"CharDesc",
	"Aires",
	"Daily_Reward_Time",
	"CurrentLand",
	"Gender",
	"Tool",
	"Skin Tone",
	"Face",
	"Full_Set",
	"Upper",
	"Lower",
	"Hair",
	"Head Wear",
	"Back",
	"BodyTypeScale",
	"DepthScale",
	"HeadScale",
	"HeightScale",
	"WidthScale",
	
	"Architype",
	"Power",
	"Progress",
	"Points",
	"Energy",
	"CurrentSpell",
	"MaxEnergy",
	"Sorcerer",
	"Psychic",
	"Druid",
	"Imagineet",
	"Necromancer",
	"MagicEnabled",
	"Immunity",
}

CharInfoStore:BeforeInitialGet(function(serialized)
	local deserialized = {}
	--print("In beforeInitialGet")
	for index, value in pairs(serialized) do
	--	print(index,InitialDictionary[index], value, "is the stuff")
		deserialized[InitialDictionary[index]] = value
	end
	return deserialized
end)local CurrentTime = os.time()

CharInfoStore:BeforeSave(function(deserialized)
    local serialized = {}

    for name, value in pairs(deserialized) do
		for mapIndex, mapName in pairs(InitialDictionary) do
			if mapName == name then
				serialized[mapIndex] = value
			end
		end
	end

    return serialized
end)

CharInfoStore:GetTable({
	["CharName"] = "";
	["CharDesc"] = "";
	["Aires"] = 30;
	["Daily_Reward_Time"] = 0,
	["CurrentLand"] = "Bouldaron";
	["Gender"] = "Male";
	["Tool"] = "None";
	["Skin Tone"] = {255, 204, 153};
	["Face"] = "Man 1";
	["Full_Set"] = "Violet Velvet Robes";
	["Upper"] = "Default";
	["Lower"] = "Peasent Pants";
	["Hair"] = "Brown Wavey Hair";
	['Head Wear'] = "None";
	["Back"] = "None";
	["BodyTypeScale"] = .03;
	["DepthScale"] = .8;
	["HeadScale"] = 1;
	["HeightScale"] = 1;
	["WidthScale"] = .8;	
	
	["Architype"] = "Lavender";
	["Power"] = 5;
	["Progress"] = 0;
	["Points"] = 8;
	["Energy"] = 400;
	["CurrentSpell"] = "None";
	["MaxEnergy"] = 400;
	["Sorcerer"] = 0;
	["Psychic"] = 0;
	["Druid"] = 0;
	["Imagineet"] = 0;
	["Necromancer"] = 0;
	["MagicEnabled"] = true;	
	["Immunity"] = false
})

local CharInfoInStore = CharInfoStore:Get()

for statname, statvalue in pairs(CharInfoInStore) do
	
	if type(statvalue) == 'number' then
		local intvalue = Instance.new("NumberValue")
		intvalue.Name = statname
		intvalue.Value = statvalue
		intvalue.Parent = CharacterStats
	elseif type(statvalue) == 'boolean' then
		local boolvalue = Instance.new("BoolValue")
		boolvalue.Name = statname
		boolvalue.Value = statvalue
		boolvalue.Parent =  CharacterStats
	elseif type(statvalue) == 'string' then
		local stringvalue = Instance.new("StringValue")
		stringvalue.Name = statname
		stringvalue.Value = statvalue
		stringvalue.Parent = CharacterStats
	elseif type(statvalue) == 'table' then
		local stringvalue = Instance.new("Color3Value")
		stringvalue.Name = statname
		stringvalue.Value = Color3.fromRGB(statvalue[1],statvalue[2],statvalue[3])
		stringvalue.Parent = CharacterStats
	end
end
    coroutine.resume(coroutine.create(function()
	if CharInfoInStore["Daily_Reward_Time"] ~= 0 then
		local  PlayerTime = CharInfoInStore["Daily_Reward_Time"]
		local TimeSinceLastPlay = CurrentTime - PlayerTime
		print("Time since last claim "..TimeSinceLastPlay, Player.Name, PlayerTime, 
CurrentTime)
		if (TimeSinceLastPlay / 3600) >= hourwait then
			-- player is eligible for reward
			local reward = Possible_Rewards[math.random(1,#Possible_Rewards)]
			self:FireClientEvent("Daily_Reward_Event", Player, hourwait, reward)
			connection = function(TriggeringPlayer)
				if TriggeringPlayer == Player then
					Player:WaitForChild("CharacterStats"):WaitForChild("Aires").Value = 
Player:WaitForChild("CharacterStats"):WaitForChild("Aires").Value + reward
					CharInfoInStore["Aires"] = CharInfoInStore["Aires"] + reward
					
					CharInfoInStore["Daily_Reward_Time"] = os.time()
					CharInfoStore:Set(CharInfoInStore)
				end
			end
		end
	else
		print("New Player, going to set new os.time", Player.Name, 
CharInfoInStore["Daily_Reward_Time"])
		CharInfoInStore["Daily_Reward_Time"] = os.time()
		CharInfoStore:Set(CharInfoInStore)
	end
end))
TROA_DATASTORE_SERVICE:MasterStore(Player,"CharInfoStore"..key)
end

--Inventory Store--------------------------------------------------------------------------------------------------------------- 

function TROA_DATASTORE_SERVICE:Inventory_Store(Player)
local Inventory_Store = DataStore2("Inventory_Data"..key, Player)

local Inventory = Instance.new("Folder")
Inventory.Name = "Player_Inventory"
Inventory.Parent = Player

local Apparel_Folder = Instance.new("Folder")
Apparel_Folder.Name = "Apparel"
Apparel_Folder.Parent = Inventory
	
local Tool_Folder = Instance.new("Folder")
Tool_Folder.Name = "Tool"
Tool_Folder.Parent = Inventory
	
local Consumable_Folder = Instance.new("Folder")
Consumable_Folder.Name = "Consumable"
Consumable_Folder.Parent = Inventory

local Intelligible_Folder = Instance.new("Folder")
Intelligible_Folder.Name = "Intelligible"
Intelligible_Folder.Parent = Inventory

local InitialDictionaryApparel = {
    --Apparel------------------------------------------------------
--Full Sets----------------------------------------------
			--Simple Velvet Robes--
				["Black Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Blue Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Gold Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Green Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Lavender Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Pink Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Red Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Violet Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["White Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
				["Yellow Velvet Robes"] = {"Type","Description", "Item_Count", 
"Equippable_Type",  "Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", 
"Toolbar_Binding", "Character_Slot", "SlotNum"};
		--Upper Body-----------------------------------------
			
		--Lower Body--------------------------------------------
			--Peasant--
				["Peasent Pants"] = {"Type","Description", "Item_Count", "Equippable_Type",  
"Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", "Toolbar_Binding", "Character_Slot", 
"SlotNum"};
			--Head Wear--------------------------------------------------------
				["Pointed Hat"] = {"Type","Description", "Item_Count", "Equippable_Type",  
"Icon", "Effect", "Worth", "Equipped_To_Toolbar", "Equipped", "Toolbar_Binding", "Character_Slot", "SlotNum"};

–Tools----------------------------------------------------------------
–Wands
[“Birch Wand”] = {“Type”,“Description”, “Item_Count”,“Equippable_Type”,“Icon”, “Effect”, “Equipped_To_Toolbar”, “Equipped”, “Toolbar_Binding”, “Character_Slot”,“SlotNum”};

–Consumables--------------------------------------------------
–Healing Potions
[“Simple Potion of Healing”] = {“Type”,“Description”, “Item_Count”,“Equippable_Type”,“Icon”, “Effect”, “Equipped_To_Toolbar”, “Equipped”, “Toolbar_Binding”, “Character_Slot”,“SlotNum”};
–Energy Potions
[“Simple Potion of Energy”] = {“Type”,“Description”, “Item_Count”,“Equippable_Type”,“Icon”, “Effect”, “Equipped_To_Toolbar”, “Equipped”, “Toolbar_Binding”, “Character_Slot”,“SlotNum”};
–Intelligibles--------------------------------------------------
–Spell Scrolls
[“Scroll of Flames”] = {“Type”,“Description”, “Item_Count”,“Equippable_Type”,“Icon”, “Effect”, “Equipped_To_Toolbar”, “Equipped”, “Toolbar_Binding”, “Character_Slot”,“SlotNum”};
}

Inventory_Store:BeforeInitialGet(function(serialized)
	local deserialized = {}
	--print("In beforeInitialGet InitialDictionaryApparel")
	for index, value in pairs(serialized) do
		for index2, value2 in pairs(value) do
			deserialized[index] = value
			deserialized[index][index2] = value2
		end
end
	return deserialized
end)

Inventory_Store:BeforeSave(function(deserialized)
    local serialized = {}

    for name, value in pairs(deserialized) do
		for mapIndex, mapName in pairs(InitialDictionaryApparel) do
			if mapIndex == name then
				serialized[mapIndex] = value
				
				 for newName, newValue in pairs(value) do
					local list= InitialDictionaryApparel[name]
					for mapIndex2, mapName2 in pairs(list) do
						if mapName2 == newName then
							serialized[mapIndex][mapName2] = newValue
						end
					end
				end
			end
		end
	end

    return serialized
end)


Inventory_Store:GetTable({
--Apparel----------------------------------------------------------
--Full Sets----------------------------------------------
	--Simple Velvet Robes--
		["Black Velvet Robes"] = {["Type"] = "Apparel",["Description"] = "A Robe for the common 
Witch or Wizard", ["Item_Count"] = 5,["Equippable_Type"] = "Full_Set",  ["Icon"] = 
"rbxassetid://3882850634", ["Effect"] = 25, ["Worth"] = 50, ["Equipped_To_Toolbar"] = false, 
["Equipped"] = false, ["Toolbar_Binding"] = "Unequipped", ["Character_Slot"] = "Unequipped", 

[“SlotNum”] = “”};
[“Blue Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the common
Witch or Wizard”, [“Item_Count”] = 5,[“Equippable_Type”] = “Full_Set”, [“Icon”] =
“rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false,
[“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,
[“SlotNum”] = “”};
[“Gold Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the common
Witch or Wizard”, [“Item_Count”] = 5,[“Equippable_Type”] = “Full_Set”, [“Icon”] =
“rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false,
[“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,
[“SlotNum”] = “”};
[“Green Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the
common Witch or Wizard”, [“Item_Count”] = 2,[“Equippable_Type”] = “Full_Set”, [“Icon”] =
“rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false,
[“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,
[“SlotNum”] = “”};
[“Lavender Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the
common Witch or Wizard”, [“Item_Count”] = 1,[“Equippable_Type”] = “Full_Set”, [“Icon”] =
“rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false,
[“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,
[“SlotNum”] = “”};
[“Pink Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the common
Witch or Wizard”, [“Item_Count”] = 5,[“Equippable_Type”] = “Full_Set”, [“Icon”] =
“rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false,
[“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,
[“SlotNum”] = “”};
[“Red Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the common Witch or Wizard”, [“Item_Count”] = 5,[“Equippable_Type”] = “Full_Set”, [“Icon”] = “rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false, [“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,[“SlotNum”] = “”};
[“Violet Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the common Witch or Wizard”, [“Item_Count”] = 5,[“Equippable_Type”] = “Full_Set”, [“Icon”] = “rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false, [“Equipped”] = true, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Upper”,[“SlotNum”] = “”}; – Equipped right now
[“White Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the common Witch or Wizard”, [“Item_Count”] = 5,[“Equippable_Type”] = “Full_Set”, [“Icon”] = “rbxassetid://3882850634”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false, [“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,[“SlotNum”] = “”};
[“Yellow Velvet Robes”] = {[“Type”] = “Apparel”,[“Description”] = “A Robe for the common Witch or Wizard”, [“Item_Count”] = 2,[“Equippable_Type”] = “Full_Set”, [“Icon”] = “rbxassetid://3882851079”, [“Effect”] = 25, [“Worth”] = 50, [“Equipped_To_Toolbar”] = false, [“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,[“SlotNum”] = “”};
–Upper Body-----------------------------------------

	--Lower Body--------------------------------------------
	--Peasant--
		["Peasent Pants"] = {["Type"] = "Apparel",["Description"] = "~Speaks for itself~", ["Item_Count"] = 3,["Equippable_Type"] = "Lower", ["Icon"] = "rbxassetid://3891589519", ["Effect"] = 1, ["Worth"] = 50, ["Equipped_To_Toolbar"] = false, ["Equipped"] = false, ["Toolbar_Binding"] = "Unequipped", ["Character_Slot"] = "Unequipped", ["SlotNum"] = ""};
	--Head Wear--------------------------------------------------------
		["Pointed Hat"] = {["Type"] = "Apparel",["Description"] = "A hat for the truest Witch or Wizard, simple, yet iconic", ["Item_Count"] = 1,["Equippable_Type"] = "Head Wear", ["Icon"] = "rbxassetid://3891589519", ["Effect"] = 60, ["Worth"] = 100, ["Equipped_To_Toolbar"] = false, ["Equipped"] = false, ["Toolbar_Binding"] = "Unequipped", ["Character_Slot"] = "Unequipped",["SlotNum"] = ""};

–Tools-------------------------------------------------------
–Wands--------------------------------------------
[“Birch Wand”] = {[“Type”] = “Tool”,[“Description”] = “A simple but sturdy wand, found from and crafted from the branch of a brich tree, and blessed with the essence of a Driad.”, [“Item_Count”] = 1,[“Equippable_Type”] = “Wand”, [“Worth”] = 360, [“Icon”] = “rbxassetid://3891295314”, [“Effect”] = 20, [“Equipped_To_Toolbar”] = false, [“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”,[“Character_Slot”] = “Unequipped”,[“SlotNum”] = “”};

–Consumables------------------------------------------
–Healing Potions---------------------
[“Simple Potion of Healing”] = {[“Type”] = “Consumable”,[“Item_Type”] = “Health Potion”, [“Description”] = “A Potion of simple healing and stuff”, [“Item_Count”] = 20,[“Equippable_Type”] = “Potion”, [“Worth”] = 25, [“Icon”] = “rbxassetid://2016644646”, [“Effect”] = 25, [“Equipped_To_Toolbar”] = false, [“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”, [“SlotNum”] = “”};
–Energy Potions-----------------------
[“Simple Potion of Energy”] = {[“Type”] = “Consumable”,[“Item_Type”] = “Energy Potion”, [“Description”] = “A Potion of simple Energy and stuff”, [“Item_Count”] = 3,[“Equippable_Type”] = “Potion”, [“Worth”] = 25, [“Icon”] = “rbxassetid://2016644117” , [“Effect”] = 23, [“Equipped_To_Toolbar”] = false, [“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”, [“SlotNum”] = “”};

–Intelligibles----------------------------------------------
–Spell Scrolls-------------------------
[“Scroll of Flames”] = {[“Type”] = “Intelligible”,[“Description”] = “A scroll of ‘Mortal Magic’, if you have not the power to wield the form of magic within this scroll with your own power, then this will suffice for the time being.” , [“Icon”] = “rbxassetid://3891589519”, [“Item_Count”] = 10,[“Equippable_Type”] = “Scroll”, [“Effect”] = “Crimbastu lackra”, [“Worth”] = 100, [“Equipped_To_Toolbar”] = false, [“Equipped”] = false, [“Toolbar_Binding”] = “Unequipped”, [“Character_Slot”] = “Unequipped”,[“SlotNum”] = “”};

–========================================================================================================================================================================================================================================================================================================================

})

local Inventory_Store_Gotten = Inventory_Store:Get()

for dicname, dicvalue in pairs(Inventory_Store_Gotten) do
	local Item_Folder = Instance.new("Folder")
	Item_Folder.Name = dicname
	Item_Folder.Parent = Inventory:WaitForChild(Inventory_Store_Gotten[dicname]["Type"])
		
	for statname, statvalue in pairs(dicvalue) do
		local ValueObject
		if type(statvalue) == 'number' then
			ValueObject = Instance.new("NumberValue")
		elseif type(statvalue) == 'boolean' then
			ValueObject = Instance.new("BoolValue")
		elseif type(statvalue) == 'string' then
			ValueObject = Instance.new("StringValue")
		end
	
		if ValueObject then
			ValueObject.Name = statname
			ValueObject.Value = statvalue
			ValueObject.Parent = Item_Folder
		end
	end
end

TROA_DATASTORE_SERVICE:MasterStore(Player,"Inventory_Data"..key)
 end
--end

--Spells Store------------------------------------------------------------------------------------------------------------------- 

  function TROA_DATASTORE_SERVICE:Spells_Store(Player)
local SpellsStore = DataStore2("SpellsStorage"..key, Player)

local SpellData = Instance.new("Folder")
SpellData.Name = "SpellData"
SpellData.Parent = Player

local InitialDictionary = {
		"Basic Shield",
		"Orlora",
		"Branda Mirun",
		"Valroc Mirun",
		"Varia",
		"Orlovium",
		"Caecus",
		"Crimbiu",
		"Crimbastu Lackra",
		"Fustama Truvista Livistu",
		"Orlovick",
		"Flithrumar Calivum Brathcavan",
		"Duble Baldadre Hadra",
		"Ible Siezumeum",
		"Kremvuck Druv",
		"Crackaltul",
		"Bloniadile",
		"Arathalat",
		"Acramenium Triumtat",
		
		"Basic Shield Mastery",
		"Orlora Mastery",
		"Branda Mirun Mastery",
		"Valroc Mirun Mastery",
		"Varia Mastery",
		"Orlovium Mastery",
		"Caecus Mastery",
		"Crimbiu Mastery",
		"Crimbastu Lackra Mastery",
		"Fustama Truvista Livistu Mastery",
		"Orlovick Mastery",
		"Flithrumar Calivum Brathcavan Mastery",
		"Duble Baldadre Hadra Mastery",
		"Ible Siezumeum Mastery",
		"Kremvuck Druv Mastery",
		"Crackaltul Mastery",
		"Bloniadile Mastery",
		"Arathalat Mastery",
		"Acramenium Triumtat Mastery",
}

SpellsStore:BeforeInitialGet(function(serialized)
	local deserialized = {}
	--print("In beforeInitialGet")
	for index, value in pairs(serialized) do
	--	print(index,InitialDictionary[index], value, "is the stuff")
		deserialized[InitialDictionary[index]] = value
	end
	return deserialized
end)

SpellsStore:BeforeSave(function(deserialized)
    local serialized = {}

    for name, value in pairs(deserialized) do
		for mapIndex, mapName in pairs(InitialDictionary) do
			if mapName == name then
				serialized[mapIndex] = value
			end
		end
	end

    return serialized
end)

SpellsStore:GetTable({
		["Basic Shield"] = true;
		["Orlora"] = true;
		["Branda Mirun"] = false;
		["Valroc Mirun"] = false;
		["Varia"] = false;
		["Orlovium"] = false;
		["Caecus"] = false;
		["Crimbiu"] = false;
		["Crimbastu Lackra"] = false;
		["Fustama Truvista Livistu"] = false;
		["Orlovick"] = false;
		["Flithrumar Calivum Brathcavan"] = false;
		["Duble Baldadre Hadra"] = false;
		["Ible Siezumeum"] = false;
		["Kremvuck Druv"] = false,
		["Crackaltul"] = false,
		["Bloniadile"] = false;
		["Arathalat"] = false; 
		["Acramenium Triumtat"] = true;
		
		["Basic Shield Mastery"] = 2;
		["Orlora Mastery"] = 2;
		["Branda Mirun Mastery"] = 2;
		["Valroc Mirun Mastery"] = 2;
		["Varia Mastery"] = 2;
		["Orlovium Mastery"] = 2;
		["Caecus Mastery"] = 2;
		["Crimbiu Mastery"] = 2;
		["Crimbastu Lackra Mastery"] = 2;
		["Fustama Truvista Livistu Mastery"] = 2;
		["Orlovick Mastery"] = 2;
		["Flithrumar Calivum Brathcavan Mastery"] = 2;
		["Duble Baldadre Hadra Mastery"] = 2;
		["Ible Siezumeum Mastery"] = 2;
		["Kremvuck Druv Mastery"] = 2,
		["Crackaltul Mastery"] = 1,
		["Bloniadile Mastery"] = 2;
		["Arathalat Mastery"] = 2;
		["Acramenium Triumtat Mastery"] = 1;
	})
	
local SpellsInStore = SpellsStore:Get()

for statname, statvalue in pairs(SpellsInStore) do
	if type(statvalue) == 'number' then
		local intvalue = Instance.new("NumberValue")
		intvalue.Name = statname
		intvalue.Value = statvalue
		intvalue.Parent = SpellData
	elseif type(statvalue) == 'boolean' then
		local boolvalue = Instance.new("BoolValue")
		boolvalue.Name = statname
		boolvalue.Value = statvalue
		boolvalue.Parent =  SpellData
	elseif type(statvalue) == 'string' then
		local stringvalue = Instance.new("StringValue")
		stringvalue.Name = statname
		stringvalue.Value = statvalue
		stringvalue.Parent = SpellData
	end
end
TROA_DATASTORE_SERVICE:MasterStore(Player,"SpellsStorage"..key)
end

--NPC info store Store------------------------------------------------------------------------------------------------------- 
---- 
-----------------------------------------------
function TROA_DATASTORE_SERVICE:NPC_Info_Store(Player)
 local NPC_INFO_STORE = DataStore2("NPC_Info_Store"..key, Player)

local NPC_Info_Folder = Instance.new("Folder")
NPC_Info_Folder.Name = "Player_NPC_Info"
NPC_Info_Folder.Parent = Player	
local InitialDictionary = {
	["Master Aurgowith"] = {"Meeting_Num", "NPC_Type", "Status"};
	["Baria Borfthoth"] = {"Meeting_Num", "NPC_Type", "Status"};
	["Trasias Normithul"] = {"Meeting_Num", "NPC_Type", "Status"};
}

NPC_INFO_STORE:BeforeInitialGet(function(serialized)
	local deserialized = {}
	print("In beforeInitialGet InitialDictionaryNPC")
	for index, value in pairs(serialized) do
		for index2, value2 in pairs(value) do
			deserialized[index] = value
			deserialized[index][index2] = value2
		end
end
	return deserialized
end)

NPC_INFO_STORE:BeforeSave(function(deserialized)
    local serialized = {}

    for name, value in pairs(deserialized) do
		for mapIndex, mapName in pairs(InitialDictionary) do
			if mapIndex == name then
				serialized[mapIndex] = value
				
				 for newName, newValue in pairs(value) do
					local list= InitialDictionary[name]
					for mapIndex2, mapName2 in pairs(list) do
						if mapName2 == newName then
							serialized[mapIndex][mapName2] = newValue
						end
					end
				end
			end
		end
	end
    return serialized
end)

NPC_INFO_STORE:GetTable({
	["Master Aurgowith"] = {["Meeting_Num"] = 1, ["NPC_Type"] = "Major", ["Status"] = "Active"};
	["Baria Borfthoth"] = {["Meeting_Num"] = 1, ["NPC_Type"] = "Shop_Keeper", ["Status"] = "Active"};
	["Trasias Normithul"] = {["Meeting_Num"] = 1, ["NPC_Type"] = "Shop_Keeper", ["Status"] = "Active"};
})

local NPC_INFO_STORE_GOTTEN = NPC_INFO_STORE:Get()

for dicname, dicvalue in pairs(NPC_INFO_STORE_GOTTEN) do
	local Item_Folder = Instance.new("Folder")
	Item_Folder.Name = dicname
	Item_Folder.Parent = NPC_Info_Folder
	for statname, statvalue in pairs(dicvalue) do
		local ValueObject
		if type(statvalue) == 'number' then
			ValueObject = Instance.new("NumberValue")
		elseif type(statvalue) == 'boolean' then
			ValueObject = Instance.new("BoolValue")
		elseif type(statvalue) == 'string' then
			ValueObject = Instance.new("StringValue")
		end
		if ValueObject then
			ValueObject.Name = statname
			ValueObject.Value = statvalue
			ValueObject.Parent = Item_Folder
		end
	end
end
TROA_DATASTORE_SERVICE:MasterStore(Player,"NPC_Info_Store"..key)

end

function TROA_DATASTORE_SERVICE:Start()
Players.PlayerAdded:Connect(function(Player)

	coroutine.resume(coroutine.create(function()
		TROA_DATASTORE_SERVICE:Character_Store(Player)
	end))
	coroutine.resume(coroutine.create(function()
		TROA_DATASTORE_SERVICE:Inventory_Store(Player)
	end))
	coroutine.resume(coroutine.create(function()
		TROA_DATASTORE_SERVICE:Spells_Store(Player)
	end))
	coroutine.resume(coroutine.create(function()
		TROA_DATASTORE_SERVICE:NPC_Info_Store(Player)
	end))
	
	DataStore2.Combine("TROA&TPP_MasterKey"..key, "NPC_Info_Store"..key,"SpellsStorage"..key,"Inventory_Data"..key,"CharInfoStore"..key)

end)

end

Its very messy i’m sorry about that… i tried to clean it up as much as i could in the post but a lot of it for some reason it wont let me turn into a code quote so… yeah.

It’s fully possible to use Pastebin or other text-hosting website and publish it with Lua syntax.

Where should i go for that, i haven’t done that before.

Essentially though the data structure is when the player is added it creates the different stores or indexes them, then when the :Get() is called it does before initial get to unserialize, or it runs through a default table in **Datastore2:GetTable({}) ** which goes through a dictionary… and then it creates the appropriate folders and values.