Not detecting the tool

so i am making a game and i want to detect if something is equipped and delete it. but it just doesn’t work.

Script:

EquipItem.OnServerInvoke = function(player, itemName)
	for i, v in pairs(player.Backpack:GetChildren()) do
		for ii, vv in pairs(player.Character:GetChildren()) do
			if v.Name == itemName and v:IsA("Tool") then
				return "Equipped"
			else	
				if vv and not vv.Name == "HumanoidRootPart" then
					vv:Destroy()
					wait(0.1)
					v:Destroy()
					wait()
					local ToolCopy = player.Inventory[itemName]:Clone()
					ToolCopy.Parent = player.Backpack

					return "Equip"
				else
					v:Destroy()
					wait()
					local ToolCopy = player.Inventory[itemName]:Clone()
					ToolCopy.Parent = player.Backpack

					return "Equip"
				end
			end
		end
	end
end

If you want a tool to be deleted when equipped then you can do this:

local tool = script.Parent

script.Parent.Equipped:Connect(function()
tool:Destroy()
player.Character.ChildAdded:Connect(function(child)

if child:IsA("Tool") then

child:Destroy()

end

end)