I have tried running a for loop to check for each part that hit it, and then check to see if they have a humanoid, or in this case, the humanoid called "Enemy." I would like to know if there is a better way to make sure a swing only damages once per slash?
--//Check for hits\\--
blade.Touched:Connect(function(hit)
--Check if we are swinging\\--
if not swinging then return end
--Validate humanoid\\--
for i = 1, hit do
local hitHumanoid = hit.Parent:FindFirstChild("Enemy")
if hitHumanoid then
if canDamage then
--//Damaage Humanoid\\--
hitHumanoid[i]:TakeDamage(math.random(mindmg.Value,maxdmg.Value))
canDamage = false
local tag = Instance.new("ObjectValue")
tag.Name = "creator"
tag.Parent = hitHumanoid[i]
tag.Value = player
wait(8)
tag:Destroy()
end
end
end
end)

1 comment
You need to check for the tag if it already has one don't do damage.