Animation not working

My sprinting animation isnt working , there are no errors but its not budging … im using the standard fps controller with some edits to the script … i want to play the sprint animation only if im sprinting

function Update ()
{
  

   if(isSprinting == true)  
   {
     sprintAnime.Play(sprintString);
   }
   else  
   {
   sprintAnime.Stop(sprintString);
   }
   
}

If it is in the update, I believe it is constantly trying to play the animation (Every frame) resulting it in starting over each frame…

Try to use something like

if(!animation.IsPlaying(sprintString))
{
    sprintAnime.Play(sprintString);
}

To make sure it’s not already playing…