So i want my sword to be "multi-target" but the script finds one humanoid and affects that one ignoring all other humanoids. here's the code :
local weapon = script.Parent
local dmg = 20
weapon.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid")then
if CanDamage.Value == true then -- i hid where CanDamage came from
local humanoid = part.Parent:FindFirstChild("Humanoid")
humanoid:TakeDamage(dmg)
CanDamage.Value = false -- here too
end
end
end)
Thanks in advance

4 comments
Well yes, that's how it's supposed to work. It stops dealing damage the first time it finds a character. You explicitly made it do this on line 09 when you set CanDamage to false.
i set it to false to prevent it from damaging the same humanoid more than once, if i removed it would kill the player in just one it
That's not what it's doing. It isn't specific to a humanoid, what it's doing is stopping the sword from dealing damage at all.
watch this then : https://gyazo.com/4839ad333d1712ac43b9e037754e1ad5