Unity 2D Platformer Enemy flipping

I am making a 2d platformer and i want it so when the enemy is walking right its facing right and the same with left if someone can send me the code and tell me were to put it that would be great thx.

i will help u but please vote me i help so many people but they do not appreciate
thanx .attach this to the gameobject u wanna flip change the buttons a or d how u want.

using UnityEngine; using System.Collections;

public class flip : MonoBehaviour {

private float X;
private Vector3 position;

// Use this for initialization
void Start () {

X=transform.localScale.x;

position=transform.localScale;

}

// Update is called once per frame
void Update () {

if(Input.GetKey("a"))
{

position.x=X;
     //flip the texture
   transform.localScale = position;

}

else if(Input.GetKey(ā€œdā€))

{

   position.x=-X;
     //flip the texture
   transform.localScale = position;


}

}

}