Should i use tables like:
local SaveThing = {
Data1 = {}
Data2 = {}
Data3 = {}
}
then keep adding data saves to the DataStore save then updating them individualy or do a DataStore for every single one of the tables like:
local SaveThing1 = Data1{}
local SaveThing2 = Data2{}
local SaveThing3 = Data3{}
or should i create a DataStore for every single thing inside every Data like:
local Itens1 = {}
local Itens2 = {}
local Itens3 = {}
-- or
local Itens = {{"Item",Save = 1},{"Item",Save = 2},{"Item",Save = 3}} -- i don't even know if that even works...
you shuld make a table u save, this is an example
local saveTable = {["Cash"] = player.cash.value}
datastore:setasync(saveTables)
i know that i need to save it, i just want to know what is the best way to save it in a table or if it is better to separate every single item and save apart, beacuse i’m doing a game that has multimple save slots
I said you should save it all in one table like your example here
What if i have multiple things inside each save, like if i change the “Sword” to “OpSword” while going from A class do S class in diferent parts, wouldn’t it just reverse one of the changes, beacuse it get the entire table to update it?
SaveThing = {
Data1 = {Itens = {"Sword","Heal Potion"},Ability = "Explosion",Class = "A",XP = 10000, Passive = "Speed Boost"}
Data2 = {Itens = {"BasicSword","Steak"},Ability = "Ice",Class = "F",XP = 10, Passive = "Reflexes"}
Data3 = {Itens = {"OpSword","Apple"},Ability = "Cheese",Class = "B",XP = 500, Passive = "Clones"}
}
Maybe i could research the DataStore:UpdateAsync
, i think it has something to fix this problem
Maybe im doing something too complex for me to understand how to do it… : P
I would do it like this.
local Data = {
Sword = {Player.Backpack.Sword.Name, Player.Backpack.Durability.Value};
Steak = Player.Backpack.Steak;
Potion = {Player.Backpack.Potion.Name, Player.Backpack.Potion.UsesLeft.Value};
}
pcall(Datastore:SetAsync("Player_" .. Player.UserId, Data))
As you can see I made up some properties to better-fit your example.
Hope this helps!
no, like, multiple saves and in those multiple saves you can have multiple of the same item
edit: nvm i could just use the last thing i said in the first message