Attempt to index number with "position"

I am trying to make a shop gui, with a localscript that will add a box for every item in a folder. But, when I am done, it says “attemt to index number with ‘position’”. Is there any way to fix this?

LocalScript
local availableTools = game.ReplicatedStorage:WaitForChild("GetTools"):InvokeServer()
local mainFrame = script.Parent:WaitForChild("MainFrame")
local safeArea = mainFrame:WaitForChild("SafeArea")
local itemInformation = safeArea:WaitForChild("ItemInformation")
local infoFrame = itemInformation.InfoFrame
local selectedItem = itemInformation.SelectedItem
local equippedItem = itemInformation.EquippedItem
local numberOfItems = #availableTools

local itemFrame = safeArea.ItemFrame
local shopButton = script.Parent:WaitForChild("ShopButton")
local buyButton = infoFrame.BuyButton
local equippedItemViewport = script.Parent:WaitForChild("EquippedItemViewport")
local itemViewport = itemInformation.ItemViewport

-- WRITE YOUR CODE AFTER THIS LINE, DO NOT PUT IT IN THE COMMENT

shopButton.MouseButton1Click:Connect(function()
	mainFrame.Visible = not mainFrame.Visible
end)

local PADDING_X = 0.02
local DROPDOWN_Y = 0.2
local DROPDOWN_X = 0.25

local item1 = itemFrame:WaitForChild("Item1")

local box 
local numRows = 1

for i = 1,numberOfItems,1 do
	if i == 1 then
		box = item1
	else
		box = item1:Clone()
		box.Name = "Item"..i
		box.Parent = itemFrame
		
		if (i-1) / (4*numRows) == 1 then
			-- New row
			numRows = numRows + 1
			box.Position = UDim2.new(PADDING_X,0,box.Position.Y.Scale,0) + UDim2.new(0,0,DROPDOWN_Y *(numRows - 1))
		else
			-- error on the line below
			box.Position = itemFrame["Item"..(i-1).Position + UDim2.new(DROPDOWN_X,0,0,0)]
		end
	end
end

change to:

itemFrame["Item"..(i-1)].Position + UDim2.new(DROPDOWN_X,0,0,0)
1 Like