Items is not a valid member of ScrollingFrame "Players.Name.PlayerGui.Shop.MainFrame.SafeArea.ItemFrame"

So I’m currently making a shop system script and I wanted to have the item image to show up on the item viewport which is this:

but the image wont show up which got me this error:

So how would I be able to fix that bug have image of items show up on the viewpoint?

My script:

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

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
			-- Add to X only
			box.Position = itemFrame["Item"..(i-1)].Position + UDim2.new(DROPDOWN_X, 0,0,0)
		end
	end
	box.MouseButton1Click:Connect(function()
		for _,v in pairs(itemViewport:GetChildren()) do
			if not v:IsA("Frame") then
				v:Destroy()
			end
		end
		local itemViewPortCam = Instance.new("Camera")
		itemViewPortCam.Parent = itemViewport
		
		local handle = game.ReplicatedStorage:FindFirstChild("ToolModels"):FindFirstChild(availableTools[i][1].."Handle"):Clone()
		handle.Parent = itemViewport
		itemViewport.CurrentCamera = itemViewPortCam
		itemViewPortCam.CFrame = handle.CameraCFrame.Value
		
		local owned = game.ReplicatedStorage.ItemCheck:InvokeServer(availableTools[i][1])
		
		if equippedItem.Value == availableTools[i][1] then
			infoFrame.Cash.Text = "Owned"
			infoFrame.BuyButton.Text = "Unequip"
		elseif owned == true then
			infoFrame.Cash.Text = "Owned"
			infoFrame.BuyButton.Text = "Equip"
		else
			infoFrame.BuyButton.Text = "Buy"
			infoFrame.Cash.Text = "$".. availableTools[i][2]
		
		end
		infoFrame.ItemName.Text = availableTools[i][1]
		selectedItem.Value = availableTools[i][1]
		
		for _,v in pairs(itemFrame:GetChildren()) do
			if v:IsA("ImageButton") then
				v.BorderSizePixel = 0
			end
		end
		itemFrame["Item "..i].BorderSizePixel = 2 -- this line causes that error
	end)
end

I think your problem is just a space/miss spell

box.Name = "Item"..i    -- this is where you name the item so it would be like  Item1

itemFrame["Item "..i].BorderSizePixel = 2 -- this line causes that error   -- this is where you try to reference item with something like    Item 1   just replace it with the below no space at the end of item

itemFrame["Item"..i].BorderSizePixel = 2  -- fixed line

The error is gone but the item image still wont show up. Would that be a different issue?

yea I don’t see where on each item box you are setting an image label and on the viewport you have to set the camera looking at the item and a certain distance from it

a way I like to do this is using CFrame.new(mainposition, look at this position )
so it would look something like this CFrame.new(Object.Position + Vector3.new(4,2,4), Object.Position) – the vector3 there may need adjusted depending on the objects location and size so if you set all your objects to position to Vector3.new() – they would be at 0,0,0 which will make it easier

also make sure your viewport is set visible