Change sprite when moving(2D)

I want the player sprite to change when moving the player. It worked when I tried it with a few if statements (If ‘S’ is pressed change the sprite to something, etc), but when I tried to do it with the Input.GetAxis, it doesn’t change the sprite. Here’s the code (arrow is an array of sprites) :
124359-screenshot-3.png

Hello I have found the problem,

The Problem is

private Sprite “spr” will get only sprite what you actually need is

private SpriteRenderer spr;

void Start()
{
spr = this.getcomponant();

}

move()
{

spr = changeSprite();
}