Hello Developers!
I was messing around with my tool when I came across a problem where it would play the animation and attack if I clicked. I thought about using debounce to stop the player from spamming an attack but I just don’t know how I would do this with this specific part of my code.
script.Parent.Activated:Connect(function()
if canAttack == true and activated == true then
attack:Play()
script.Parent.Stun.Swing:Play()
script.Parent.Hitbox.Touched:Connect(function(hit)
if not debounce then
debounce = true
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
hit.Parent.Humanoid:TakeDamage(2)
script.Parent.Stun.StunHit:Play()
end
end
end)
attack.Stopped:Wait()
attack:Stop()
end
end)
Thank you,
Ultan