Is there a way to loop until animation stops playing?

uh title basically
trying to run a loop on a attack animation to see if it hits anything during the animation to deal damage to it :smiley:

I have no idea what you just said, but there are 3 articles that can help you out:

A more convenient way to track hits is to use .Touched event in combination with animation events. You add 2 events to the animation track: one in the beginning of the attack and one at the end of your attack. Then you listen for these events and write a boolean. Example:

local Attacking = false;
AnimationTrack:GetMarkerReachedSignal("attackBegin"):Connect(function()
    Attacking = true;
end);
AnimationTrack:GetMarkerReachedSignal("attackEnd"):Connect(function()
    Attacking = false;
end);
Blade.Touched:Connect(function(basePart)
    if Attacking then
        -- register hit if we're attacking, otherwise we don't do anything.
    end;
end);

No loops necessary!