Detect Player Holding a Tool!

I was provided with a script that Detected If A player had More than one item in their Backpack and then made a teleport. But, if the player has one tool out and another in their Backpack, it doesn’t count it because it’s no longer in their Backpack. Anyway I could detect that?

script:

part.Touched:Connect(function(hit)
local player = Players:GetPlayerFromCharacter(hit.Parent)
if player then
local Backpack = player.Backpack:GetChildren()
local gui = player:WaitForChild(“PlayerGui”):WaitForChild(“OneTool”)
local gui2 = gui:WaitForChild(“Frame”)

	if #Backpack >= 2 then
		
		hit.Parent.HumanoidRootPart.CFrame = CFrame.new(-301.379, -229.5, -1811.725)
		
		gui2.Visible = true
		
		wait(8)
		
		gui2.Visible = false

	else
		
	end


end

end)

local count = #backpack:GetChildren() -- number of tools in backpack

if character:FindFirstChildOfClass'Tool' then
    -- if tool on character then add 1 to the count
    count += 1
end

if count >= 2 then
    -- do stuff
end
1 Like

It didn’t Work but, thanks for the reply!