I’m trying to save and unpack multiple tables in one datastore, here is my code right now:
local DSS = game:GetService('DataStoreService')
local DS = DSS:GetDataStore('PlrInventory')
game.Players.PlayerAdded:Connect(function(player)
local inv = player.PlayerGui:WaitForChild('Inventory'):WaitForChild('Inventory')
local Data
local success, err = pcall(function()
Data = DS:GetAsync(player.UserId..'Inv')
end)
if Data then
local Dat = {unpack(Data)}
for i=1, #Dat do
local Item = game.ReplicatedStorage.Item:Clone()
local DatB = {unpack(Dat[i])}
Item.Name = DatB[1]
Item.Nom.Text = DatB[2]
Item.Desc.Text = DatB[3]
Item.Image = DatB[4]
end
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local InvTable = {}
for i,v in pairs(player:WaitForChild('PlayerGui').Inventory.Inventory:GetChildren()) do
if v:IsA('ImageButton') then
local Properties = {
v.Name,
v.Nom.Text,
v.Desc.Text,
tostring(v.Image)
}
local prop = {unpack(Properties)}
for i=1, #prop do
print(prop[i])
end
table.insert(InvTable, Properties)
end
end
DS:SetAsync(player.UserId..'Inv', InvTable)
end)
Currently, the data save isn’t outputting anything. If anybody has any information on this please tell.