Items being rewritten over one another in a table (how to have multiple of saw type of item)

I have a data store system that saves a players house and the items they have. Problem is, I store all furniture info (item, color, position, etc.) inside a table. If you have 2 Chairs for example, it rewrites the old chairs data, with the other chair, and thus only 1 chair gets saved

local Items = {Exterior = {}, Interior = {}, Landscape = {}, Furniture = {}}
	
	-- Get the furniture
	for _, item in pairs(PlayersInterior.Build.Furniture:GetChildren()) do
		print('Grabbing furniture')
		local PurchaseData = {}
		local PrimaryPart = item.PrimaryPart
		local Position = PlayersInterior.PrimaryPart.CFrame:inverse() * PrimaryPart.Position
		local Direction = PrimaryPart.CFrame.lookVector
		
		PurchaseData.Position = {
			Position.X, 
			Position.Y, 
			Position.Z, 
			Direction.X, 
			Direction.Y, 
			Direction.Z
		}
		
		local Primary = item:FindFirstChild('Primary')
		PurchaseData.Primary = Primary.BrickColor.Name
		
		local Secondary = item:FindFirstChild('Secondary')
		if Secondary then
			PurchaseData.Secondary = Secondary.BrickColor.Name
			
			local Tertiary = item:FindFirstChild('Tertiary')
			if Tertiary then
				PurchaseData.Tertiary = Tertiary.BrickColor.Name
			end
		end
		print('Adding', item.Name, 'to data')
		Items.Furniture[item.Name] = PurchaseData
	end

And then with this table, I use a module that converts the table into Values, so I can store it with DataStore2

local NewDataFolder = Converter.Convertr(Items)
NewDataFolder.Name = PlayerData.House.Value

But my main question lies with how to store multiple items with the same name? I know it has something to do with this line

Items.Furniture[item.Name] = PurchaseData

Basically, if there’s a ‘Chair’ already saved, then it gets that Chair, instead of creating a new ‘Chair’ with its own PurchaseData

EDIT It needs to look like this basically

Items.Furniture = {
    ['Chair'] = {
        -- CFrames, Color, etc.
    },

    ['Chair'] = {},
        -- CFrames, Color, etc.
    },
}

Where as at the moment, it only saves 1.

I tried

Items.Furniture[#Items.Furniture + 1] = PurchaseData

And yes this saves all chairs, but the name of each one is now 1, 2, 3, 4, etc.

So, fundamentally, you can’t have a dictionary with two indices of the same name. You will need to change the way you store furniture information.

Bad potential solution: keep using the name of the furniture as the key, and store a matrix of chairs

Items.Furniture = {
   ['Chair'] = {
      {CFrame, Color, ...},
      {CFrame2, Color2, ...},
   }
}

Ideal solution (in my opinion):

Just add an additional data field for the name of the furniture item

Would that cause more problems? As if I wanted to refer back to the item I’d have to go

item.Name.Value

And it’d pick up the items ‘Name’ (the name being obviously 1, 2, 3, etc.) and then erroring out cause the Name property doesn’t have a Value property as well

I know I could do like ‘ItemName’ but that’s kinda redundant :confused: