Attempt to index nil with 'Clone'

Hello, I have another problem with my script.

So, I am trying to create a script that will automatically add a box with the item information in it. The problem is, the script works for 1 item, but when I click the other item, I get this message:

image_2022-02-16_192025
Can you help? I think something went wrong on Line 62. (this is a localscript)

-- Core UI 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
			-- Add to the 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
		--THE CODE BELOW IS WHAT WENT WRONG
		local handle = game.ReplicatedStorage:WaitForChild("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
		
	end)
end

item1 is an invalid object or gets destroyed, you can use an if statement to check if item1 is valid:

if not item1 then
   warn("Item1 has not been found or has been destroyed!"
end

If its a part, anchor the object.

Item1 is an ImageButton inside of a few frames in a screen gui.

Check for a warning if the object is found, by the WaitForChild function.

Line 28 is already local item1 = itemFrame:WaitForChild("Item1").

No I meant as in the other warnings show in the console, if there are any.

Nope, there is just that one error in the output. (the title of the topic)

what is the out put of this

--THE CODE BELOW IS WHAT WENT WRONG
		print("looking for :",availableTools[i][1].."Handle",": in",game.ReplicatedStorage:WaitForChild("ToolModels"):GetChildren())
		local handle = game.ReplicatedStorage:WaitForChild("ToolModels"):FindFirstChild(availableTools[i][1].."Handle"):Clone()
		handle.Parent = itemViewport

can you press the ➤ to show what’s in the table for the noob swordhandle

game.ReplicatedStorage:WaitForChild("GetTools"):InvokeServer()
returns a table with "Noob " as the exact string in it. Check server code to see why it’s doing that. It should be just "Noob"

What should I do to fix the box that isn’t loading?

I fixed this by removing ALL spaces in the tool name. Thanks for your help anyway!