I dont understand how to save tables in datastore

I wanted to do an Inventory System that saves the ID and then u can get the inv in the next session.
I looked everywhere and i still didnt understand how to do it.

I would be grateful if you helped me.
And if u want to help me more, could you tell me how to like make that the table save numbers that are portraying the numbers, that multiple items can be saved.

local InventoryD = DataStore:GetDataStore("Inv")


local DataStore = game:GetService("DataStoreService")
local Inv = DataStore:GetDataStore("Inv")


local R_INV = game.ReplicatedStorage.Inventory.Events:WaitForChild("Recieve_INV")
local Send_INV = game.ReplicatedStorage.Inventory.Events:WaitForChild("Send_INV")


local Inventory = { -- Example Player Inventory

}

game.Players.PlayerAdded:Connect(function(plr)
	local folder = Instance.new("Folder",plr)
	folder.Name = "Inven"


	local success,errorMessage = pcall(function()
		local data = Inv:GetAsync(plr.UserId, "InventoryValue", Inventory)
		
		Inventory = data[1]
		print(Inventory)
	end)
	
	if success then
		print("Data successfully loaded!")
	end
	if errorMessage then
		warn(errorMessage)
	end

	game.Players.PlayerRemoving:Connect(function(plr)
		local coins = plr.Ingame.Coins

		Inv:SetAsync(plr.UserId.. "Inv", Inventory)
	end)

	game:BindToClose(function()
		for i,plr in pairs(game.Players:GetPlayers()) do
			local coins = plr.Ingame.Coins


			Inv:SetAsync(plr.UserId.. "Inv", Inventory)
		end
	end)

end)

R_INV.OnServerEvent:Connect(function(ID, plr)
	
	local success,errorMessage = pcall(function()
		local data = Inv:GetAsync(plr.UserId)
		
		print(Inventory)
	end)
	
	table.insert(Inventory, ID)
	Inv:SetAsync(plr.UserId.. "Inv", Inventory)
	print(Inventory)
end)

game.Players.PlayerAdded:Connect(function(player)
	Send_INV:FireClient(player, Inventory)
end)