To clarify, I want to know how I can STOP it from dealing damage when the tool is NOT moving, and how it CAN deal damage ONLY when the tool is moving. I don't want to to be like the classic roblox sword.
I have this script here, I need to know what I can add to it that will allow the tool to deal damage ONLY when its animation plays..
Script:
local Tool = script.Parent
local Animation = Tool.Animation
local activeCooldown = false
local cooldownTime = 3
Tool.Activated:Connect(function()
if (activeCooldown) then
return
else
activeCooldown = true
local Character = Tool.Parent
local Humanoid = Character.Humanoid
local AnimationTrack = Humanoid:LoadAnimation(Animation)
cooldownTime = AnimationTrack.Length
AnimationTrack:Play()
wait(3)
activeCooldown = false
end
end)
thanks, needed to revise to make it a bit more understandable lol

11 comments
you mean like a sword?
Yes, but I dont want the "sword" to deal damage if its not even moving, but when the animation plays.
there you go
its a custom made tool though, not a sword
I'm having the same problem, this is the default sword script, even if the HAMMER isn't moving, it still deals damage. Right back to square one..
should've given more context
You need to make it more descriptive
Tho the script only deal damage when your animation started
I already tested it myself
AHA! My bad, I forgot I was supposed to replace the original script. lol
-_-