animation script not working

Hello,
I am trying to make a move script for my player and I have the move part down I just can’t seem to get the animations working. I have made my animation into a animation controller but when I wright the script:

if(Input.GetKey(“w”))
{
animation.Play(PlayerAC);
}

The console says something about the old API’s and my animation doesn’t work. I have tried to make an animation variable but that didn’t work. Any suggestions. Thank you.

Try change your model rig type to “Legacy”