Hi, I recently started to develop with DataStore2.
I know how I would save coins and etc with DataStore2. But I have had some issues with saving a dictionary/a table.
I just don’t know how to set a dictionary when a player first joins nor the right way to save it with DataStore2 API.
This is how my dictionary looks like:
userData = {
Currency = {
["Gems"] = 10;
["Coins"] = 25;
};
Items = {
["Weapons"] = {
["AK-47"] = {"Blue", "Red", "Silver", "DesertCamo"};
["Heavy Sniper"] = {"Red", "GoldRain", "Yellow"};
};
["Clothing"] = {"BlueFedora", "RedFedora", "SilverHat", "PinkPants", "Blue"};
};
WeaponsEquipped = {
["Main"] = {"Ak-47"};
["Secondary"] = {"M1A11"};
["Melee"] = {"HuntersKnife"};
["Special"] = {"FragGrenade"};
};
ClothingEquipped = {
["Pants"] = {"RedPants"};
["Hats"] = {"SilverHat"};
["Shirts"]= {"RedShirt"};
["Face"] = {"BlueGoggles"};
};
}
And I know how to access certain parts of the dictionary.
ak47Skins = userData["Items"]["Weapons"]["AK-47"]
And how to insert things:
table.inser(userData["Items"] blah blah
And how to remove, how to get all items inside the table with a for loop. And such
But not how to save it (dataStore2 way) nor how to set the dictionary to a player when they first join.
Thank you for help, feel free to ask question you might have,
Thank you!