Player Falls Over

I’m using a simple script to make the player move.

function Start () {

}

var MoveAmount = 0.15;

function Update () {

if (Input.GetKey(KeyCode.W)) {

transform.Translate (Vector3.forward * MoveAmount);

}

if (Input.GetKey(KeyCode.A)) {

transform.Translate (Vector3.left * MoveAmount);

}

if (Input.GetKey(KeyCode.S)) {

transform.Translate (Vector3.back * MoveAmount);

}

if (Input.GetKey(KeyCode.D)) {

transform.Translate (Vector3.right * MoveAmount);

}

}

I wanted to apply gravity to the player, so I added a rigidbody. The player is a capsule, so when it was translated, it literally just fell over. How can I fix this?

function Awake() {
rigidbody.freezeRotation = true;
}