Animations don't have length in their properties, so you need to do it manually. You can find the length in Animation Editor. Here are 3 steps to find animation length and put it into your script:
1. Import your animation into Animation Editor
You can import Animation Editor Animations by clicking the 3 dots, then clicking Import, and clicking "From Roblox" or "From FBX Animation"
There you can see all of the stats of the animation.
2. You can see the length somewhere in the plugin frame
The length is at the top of the plugin frame.
3. Insert animation
I will give you some edits for your script:
1 | while part.parent.Humanoid.health > = 1 do |
5 | part.parent.Humanoid.Health = part.parent.Humanoid.Health - 5 |
b_mni