Trying to find the easiest possible way to store say items a player has purchased that are linked to a certain class a player also has.
In depth explanation, game has multiple classes. Each class has multiple weapons (specific to that class) players can buy and equip. I am trying to save these purchases to the weapon, so I can just go into the ‘classes datastore’ and see which items they have purchased. For example:
['Knight'] = {
['Weapons'] = {'Classic Sword', etc...}
['Armour'] = {'Knight Armour', etc...}
}
['Archer'] = {
['Weapons'] = {'Bow', etc...}
['Armour'] = {'Archer Armour', etc...}
}
Also being able to track which item they have equipped, so they don’t have to re-equip when rejoining.
This is what I currently do (it just tracks what classes the player has unlocked, not weapons or anything like that)
local playerClasses = {player.UserId, {1, 2}}
local loadedClasses = classDataStore:GetAsync(player.UserId .. '-classes')
if loadedClasses ~= nil then
playerClasses[2] = loadedClasses
end
table.insert(classData, playerClasses)
1 and 2 being ‘Knight’ and ‘Archer’ (trying to keep low data store values)
I think the main problem with trying to do this is I have trouble ‘visioning’ what a datastore actually looks like, so I then have trouble getting information out from it, as well as adding information into it. Not sure if there is a really big indepth tutorial on datastores (looked around here and read a couple of things, but still really confused)