What's a better way to activate and deactivate hitboxes?

Currently, I just use the time of the animations to decide when the best moment to turn on and turn off the hitboxes are, however, I feel like this isn’t good at being accurate.

The DoAction() function has an argument for the hitbox which takes a table with 2 values swingStart and swingFInish. swingStart means the hitbox should turn on .8 seconds into the animation and the same idea for swingFinish.

	local actionName = "Ability1"
	local swingStart = 0.8
	local swingFinish = self.player.Animation:GetAnimationLength(actionName) - 0.8

The only other solution I can think of is using animation events or keyframe events, however, was too lazy to go through every animation and actually do that so perhaps there’s another solution before I have to do this.

There’s two different built in functions to detect accurate animation timings, which is significantly more accurate than hardcoding timings like you’re doing:

local animationTrack = humanoid:LoadAnimation(animation)

--detect specific keyframe
	print("Keyframe reached:" .. keyframeName)

--detect when animation finishes

Yeah that’s the keyframe method I was talking about, however, none of my animations have it setup and I didn’t feel like adding it, but I guess that’s the only way.