How can I damage a player only once with a Melee weapon?

I made a sword with client cast but when hitting the player it detects each limb it touches and that makes it do more damage
I want hitting a player to do the damage it’s supposed to do.

I try to make it stop damaging when the sword hits someone but that means that if the sword touches 2 players it will only damage one

Does anyone know a way to hit many people at once but do the same damage per player? :pensive:

You could simply have a debounce that’ll make sure it’d only hit him once after the animation[if u have] has ended

1 Like

but if the sword hits 2 people?

local charDebounces = {}

Sword.Hit:Connect(function(part)
 local Hum = part.Parent:FindFirstChild("Humanoid")

 if not Hum then return end

 if charDebounces[Hum] then return end
 charDebounces[Hum] = true
 
 -- Damage
end)

AnimationEnd:Connect(function()
 table.clear(charDebounces)
end)
2 Likes

Just what I was looking for thank you very much suprime chad! :wink:

2 Likes