Destroy a tool after player touches it

The tool is supposed to get destroyed when the player touches it, but for some reason it isn’t working. I don’t know if im not listing all the variables or setting the paths correctly,

The script is located inside of a folder which is located inside of the tool.

local tool = script.Parent.Parent
local handle = tool.Handle

handle.Touched:Connect(function(hit)
	if hit.Name == "Humanoid" then 
		tool:Destroy()
	end
end)
local tool = script.Parent.Parent
local handle = tool.Handle

handle.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then -- The Humanoid Does not touch it, the actual body parts like left foot/rightfoot/humanoidrootpart can touch it
		tool:Destroy()
	end
end)

This code will make the Tool Destroy when It touches A Player’s Character/Body.

The problem with checking names here, is that if the hit was a hat named Humanoid, it still would run. we dont want it, do we?
+
A humanoid cant touch a part, since it’s not a visible object, thus - change it to any other visible part, such as humanoidrootpart, head,etc.

So, simply do as @WheezWasTaken suggested above.

humanoid’s can’t hit, you’ll have to do:

local tool = script.Parent.Parent
local handle = tool.Handle

handle.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChildWhichIsA('Humanoid') then 
		tool:Destroy()
	end
end)

(also, i suggest using this over Wheez’ solution because this will find any humanoids with any name)