0

How can I make my tool deal a specific amount of damage ONLY when its animation plays?

Edited 13 days ago

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

cooldownTime = AnimationTrack.Length

AnimationTrack:Play()

wait(3)

activeCooldown = false
end
end)


thanks, needed to revise to make it a bit more understandable lol

0
you mean like a sword? The_Saver31 257 — 13d
0
Yes, but I dont want the "sword" to deal damage if its not even moving, but when the animation plays. kingsworld9 4 — 13d
0
there you go The_Saver31 257 — 13d
0
its a custom made tool though, not a sword kingsworld9 4 — 13d
0
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.. kingsworld9 4 — 13d
0
should've given more context kingsworld9 4 — 13d
0
You need to make it more descriptive The_Saver31 257 — 13d
0
Tho the script only deal damage when your animation started The_Saver31 257 — 13d
0
I already tested it myself The_Saver31 257 — 13d
0
AHA! My bad, I forgot I was supposed to replace the original script. lol kingsworld9 4 — 13d
0
-_- The_Saver31 257 — 13d

0

If you want a sword then, Here you go...

local Tool = script.Parent
local Animation = Tool.Animation
local activeCooldown = false
local cooldownTime = 3
local Blade = script.Parent.Handle -- HitPart
local Damage = 10 -- Damage

Tool.Activated:Connect(function()
if (activeCooldown) then
return
else
activeCooldown = true

local Character = Tool.Parent
local Humanoid = Character.Humanoid

cooldownTime = AnimationTrack.Length

AnimationTrack:Play()

wait(3)

activeCooldown = false
end
end)