A part in Tool Touched event not working after held by player

CollidePart = script.Parent

CollidePart.Touched:Connect(function(Part)
	if CollidePart.CanCollide == true and Part.Parent ~= script.Parent.Parent and Part.Parent.Parent ~= script.Parent.Parent and not Part.Parent:FindFirstChild("Humanoid") then
		print("working")
		script["Sword Hit"]:Play()
	end
end)

a tool with no "Handle"part but it have other part for being held.
this script is in Tool.CollidePart and this script have a sound named “Sword Hit”

even not working on simpler script.

CollidePart.Touched:Connect(function(Part)
	print("Working")
end)

I’m assuming it is a LocalScript,

LocalScripts cannot run inside Workspace, only when it is a descendant of a Player’s Character

no it’s normal script. and as i said it’s in the sword tool

If you don’t want it to play the sound so many times like that

Debounce
local debounce = false
script.Parent.Touched:Connect(function(hit)
if debounce == false then
if hit.Parent ~= script.Parent.Parent then
script["Sword Hit"]:Play()
debounce = true
script.Parent.TouchEnded:Connect(function(hit2)
if hit == hit2 then
debounce = false
end
end)
end
end
end)

Reply me if it doesn’t work please

Oh, off topic but thanks. i will use it usefully

Have I solved it? (character limit)

nah. the many time working not the problem.
the problem is Touched event working super weird after being held

It’s terribly weird. i was AFK

It is probably because it touches your hand

no. the yellow sword have no script. only the white sword.

Is the problem the sound? Because it looks like it’s working fine

no. as i always said, Touched event working weird after tool being equipped.

check the output.

ok. i don’t know why this can be solution, but i found solution.

tool have to go to player Backpack before it trashed.

i mean, it have to be
‘Backpack → Workspace’.

‘PlayerCharacter → Workspace’ making bug.

This is caused by a behind the scenes action performed by Roblox’s internal engine, when the tool is dropped into the workspace its handle’s .Touched event gets overridden and connected to a function which allows for the tool to be picked up again once its handle is touched.