What is wrong with my sword script?

When I try to use my sword on NPCs it wont do damage. (the NPCs have humanoids)

Script:


local SwingAnim = script:WaitForChild("SwingAnimation")
local Debounce = false
local PlayersHit = {}
-- Welds
for i, Parts in pairs(Handle:GetChildren()) do
	
	if Parts:IsA("BasePart") then
		
		local Weld = Instance.new("WeldConstraint")
		Weld.Part0 = Parts
		Weld.Part1 = Handle
		Weld.Parent = Parts
	end
end
-- Anim

script.Parent.Activated:Connect(function()
	
	if Debounce == false then
		Debounce = true
		
		local Humanoid = script.Parent:WaitForChild("Humanoid")
		local AnimTrack = Humanoid:LoadAnimation("SwingAnim")
		
		AnimTrack:Play()
		wait(1)
		Debounce = false
	end
	
end)

-- Damage

Handle.Parent:Connect(function(Hit)
	
	if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= script.Parent.Parent then
		
		if Debounce == true and PlayersHit[Hit.Parent] == nil then
			
			Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(50)
			
			PlayersHit[Hit.Parent] = true
			wait(1)
			PlayersHit[Hit.Parent] = nil
		end
	end
end)
2 Likes

I do not see a Touched Event or otherwise, I don’t know where you think you are getting Hit information nor can I tell what Handle.Parent is.

1 Like

Oh yeah that’s probably the problem.

much better, thank you. ``` makes a code block until the next ``` I’m using \`\`\` to show off the three tickies in a row.

1 Like

Thanks for the help! my sword needed Touched before Connect.

1 Like