Alright so, to save data from my game I use DataStore2. It saves perfectly any kind of value, the problem appears when I try to save a table. This is my code:
local UnlockedMoves = DSS2("UNLOCKED_MOVES",Player) -- if it's nil it saves as an empty table, aka {}
local MovesOwned = UnlockedMoves:Get()
if table.find(MovesOwned,sent) == nil then
table.insert(MovesOwned,sent)
UnlockedMoves:Set(MovesOwned)
for i,v in pairs(UnlockedMoves:Get()) do
print(v) -- this works perfectly fine, printing me the value (a string) on the output
end
end
*Just to specify, what I’m adding is a string, for example “Energy Wave”;
However, even if all the added values are printed, when I leave the game I get this error:
and my table doesn’t save, resulting into an empty table.
What can I do to save the table correctly? I really don’t understand what’s wrong here.