Im trying to make a tool with an attack animation and a cooldown, my system may be funky but if you can help please do. It tells me there are no errors but it doesnt deal damage to the dummy and the cooldown doesnt exist.
function attack() script.Parent.Handle.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid:TakeDamage(30) warn("Hit successful") end end) end script.Parent.Equipped:Connect(function(Mouse) Mouse.Button1Down:Connect(function() local animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation) animation:Play() attack() script.Disabled = true wait(3) script.Disabled = false end) end)