part.Touched triggering

script.Parent.Touched:Connect(function(hit)
	local name = hit.Parent.Name
	local value = false
	if hit.Parent:FindFirstChild("Humanoid") then -- checks if its a character
		if hit.Parent.Name == name then -- checks if the character's name matches up with the name earlier
			if value == true then
				print("a") -- for bug testing
				hit.Parent.Humanoid:TakeDamage(20) -- deals damage
				script.Parent:Destroy() -- destroys part
			end
		end
	end
end)

i confused a few things, it seems to be working properly now. i appreciate your help!

local part = workspace.Part
local debounce = false

part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("HumanoidRootPart") then
		local humanoid = hit.Parent:FindFirstChild("Humanoid")
		if debounce then
			return 
		end
		debounce = true
		humanoid:TakeDamage(20)
		task.wait(0.25)
		part:Destroy()
		debounce = false
	end
end)