How to know if there is 2 tools with the same name inside the players backpack?

here is my current script

function check(tools)
	local found = {}
	for i,v in pairs(tools:GetDescendants()) do
		if v:IsA("Tool") then
			if table.find(found,v.Name) then
				return true
			else
				table.insert(found,v.Name)
			end
		end
	end
	return false
end

Could you add more to the topic. I would need the full script to see the problem.

What you are looking for is a function to determine if all the entries in a table are unique. Try this:

function check(tools)
	-- First we generate counts of all the tools.
	local toolCount = {}
	for i, v in pairs(tools:GetChildren()) do
		if toolCount[v.Name] == nil then
			toolCount[v.Name] = 1
		else
			toolCount[v.Name] += 1
		end
	end

	-- Now we check to see if any of the counts are greater than 1.
	for _, v in pairs(toolCounts)
		if v ~= 1 then
			return true
		end
	end

	-- Tool was not found.
	return false
end

First, this scans the table and generates counts of all the tools using their names. Then it looks through the counts to see if any are not equal to 1. If there is something that is not equal to 1, the function returns true. If there are no duplicate entries, then the function returns false.