Help with accelerometer (C#)

Hi Guys,

Basically i am trying to make a script to when i tilt my phone in the x axis my player moves right or left.

Thank You

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {
	public float playerSpeed = 20.0f;
	// Use this for initialization
	void Start () {
		transform.position = new Vector3(0 , 4, 0);
	
	}
	
	// Update is called once per frame
	void Update () {

		if (Input.acceleration.x){
			transform.Translate(Vector3.right *Input.GetAxis("Horizontal") * playerSpeed);
		}
	
	}

}

Did you try the example in the documentation?

    using UnityEngine;
using System.Collections;

public class Example : MonoBehaviour {
    public float speed = 10.0F;
    void Update() {
        Vector3 dir = Vector3.zero;
        dir.x = -Input.acceleration.y;
        dir.z = Input.acceleration.x;
        if (dir.sqrMagnitude > 1)
            dir.Normalize();
        
        dir *= Time.deltaTime;
        transform.Translate(dir * speed);
    }
}