[SOLVED] C# | Animation Loops

Hello sorry for such a basic question but for the life of me I can’t get animations to loop correctly, and I don’t know what I’m doing wrong, my animations play for 1 second then stop, despite having the loop flag enabled Here is what I currently have:

async void Dance(int id)
        {
            // RETURN IF THE ID DOES NOT BELONG TO THE PLAYER!
            if (IsPlayer(id) == false)
                return;

            // LOAD ANIMATION DICT
            Function.Call(Hash.REQUEST_ANIM_DICT, "special_ped@mountain_dancer@base");
            while (!Function.Call<bool>(Hash.HAS_ANIM_DICT_LOADED, "special_ped@mountain_dancer@base")) await Delay(50);

            // CLEAR ALL TASKS, PLAY DANCE ANIMATION, BUT LOOP AND CANCEL WITH MOVEMENT
            Game.PlayerPed.Task.ClearAllImmediately();
            AnimationFlags flags = AnimationFlags.Loop | AnimationFlags.CancelableWithMovement;
            Game.PlayerPed.Task.PlayAnimation("special_ped@mountain_dancer@base", "base", 1, 1000, flags);
        }
2 Likes

Nevermind I forgot you had to set blend in speed and duration to both be -1 to allow the flags to be the only factors in what the animation does, so I have corrected it now by doing the following:

Game.PlayerPed.Task.PlayAnimation("special_ped@mountain_dancer@base", "base", -1, -1, flags);
1 Like