How can I add proper debounce to this?

I haven’t written the code yet, it’s all theoretical.

Basically, I’m trying to make a hit combo system for my katana. Essentially what I’m doing is triggering an animation event near the end of the animation, and if you click during the time between the animation event is fired and the animation ends, it will trigger the next step of the combo.

But the way I’d add debounce eludes me. I want it to only trigger if the animation ends before you click again, but I’m assuming if I just use animation.stopped that won’t work, because the animation is still going to be hard stop by the next animation in the combo, right? Or will that not trigger it?

If I’m wrong, and that solution I just proposed would work, then do tell me. Otherwise, how should I add debounce to this?