i wanted to use saving in my game in order to save customized animated characters. i had basically used a little template that went like this:
charabase = {
idle1 = "",
idle2 = "",
walk = {
walk1 = "",
walk2 = "",
walk3 = "",
walk4 = ""}
jump = "",
fall = "",
fly = {
fly1 = "",
fly2 = "",
fly3 = "",
flyidle = ""}
offset = 0,
scale = Vector2.new(0, 0),
idlespeed = 0,
walkspeed = 0,
name = ""}
and had it repeat in another array. i wrote a function to basically duplicate these values into the newer tables, so i wouldn’t have to copy+paste and waste up lines. it was like this:
local data = {
SavedCharas = {
["chara1"] = {},
["chara2"] = {},
["chara3"] = {},
["chara4"] = {},
["chara5"] = {},
["chara6"] = {},
["chara7"] = {},
["chara8"] = {},
["chara9"] = {},
["chara10"] = {}
},
Stats = {
["Time"] = 0,
["Money"] = 0
}
}
for i, v in pairs(data.SavedCharas) do --BECAUSE I DON'T WANT TO WASTE LINES SETTING UP SO MUCH!!!!
for j, n in pairs(charabase) do
v[j] = n
end
end
i was using datastore2 for the above, since it seemed to use backups, something i liked. however, as i started experimenting, i started to get errors and eventually lost myself in this sea of code. i had no idea how to work datastore or datastore 2, which, i suppose is my mistake. i used wikis and youtube tutorials, but i still don’t really understand it.
basically, i want to save tables in tables. unecessary, maybe? perhaps, but i don’t really know other ways to do this.
i’m not asking for somebody to do this for me, rather, how do i even begin?