AI following my player in X coordinates

Hello Unity Community!

I’m trying to make an AI following my player in X coordinates (2D game). But my code it’s not working, what should I do?

var player : Transform;

function Start () {
player = GameObject.Find ("Player").transform;
}

function Update () {
transform.position.x = player.transform.position.x;
}