So I can swing my weapon and it does damage but there is no limit/timer on when you can swing. What I mean is you can swing with no cooldown. How would I add a cooldown?
script.Parent.Equipped:Connect(function(Mouse)
Mouse.Button1Down:Connect(function()
local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
animation:Play()
end)
end)
Also here is the script for damage if its ever needed for this.
script.Parent.blade.Touched:connect(function(p)
if script.Parent.CanDamage.Value == true then
script.Parent.CanDamage.Value = false
p.Parent.Humanoid:TakeDamage(5)
else
script.Parent.CanDamage.Value = true
p.Parent.Humanoid:TakeDamage(5)
end
end)

5 comments
Ok so when I'm standing still I can still rapidly reset/attack with my sword but it only does damage once every 5 seconds. If I move while attacking it has no cooldown and does infinite damage. so essentially it didnt cooldown my swinging but it did to the damage but this is all negated while moving
I edited the code try now
For line 10 of your code the parenthesis is underlined red and im getting the error,21:40:47.286 - Players.MrMeeper9.Backpack.Dull Dagger.LocalScript:10: Expected identifier when parsing expression, got ')'
My apology, forgot to add the end for the if statement.
No need to apologize, thanks for the help!