Suggestions for my little Script

I have made a script for my breakout game, that the paddle cant go outside the play area.
But im not sure if this is the best way to make that thing.
It would be very nice when someone could take a look at my script.
I have made at both sides of the play area a plane with a box trigger and when the paddle hits the right plane you cant move in positive direction and at the left plane its the opposite.

var playerSpeed : int;

private var atBoundsLeft : boolean = false;
private var atBoundsRight : boolean = false;

function Awake(){

}

function Update () {

// moves the player and checks for borders
if (Input.GetAxis("Horizontal")){
movement = playerSpeed * Time.deltaTime * Input.GetAxis("Horizontal");
if(atBoundsRight  movement <= 0){
transform.Translate(Vector3(movement,0,0));
}	
else if(atBoundsLeft  movement >= 0){
transform.Translate(Vector3(movement,0,0));
}
else if(!atBoundsRight  !atBoundsLeft){
transform.Translate(Vector3(movement,0,0));
}

}


}

function OnTriggerEnter (otherObject : Collider){
	if(otherObject.gameObject.tag == "bounds"){
		if(otherObject.gameObject.name == "BoundsRight"){
			atBoundsRight = true;
		}
		else
		{
			atBoundsLeft = true;
		}
		
	}
}


function OnTriggerExit (otherObject : Collider){
	if(otherObject.gameObject.tag == "bounds"){
		if(otherObject.gameObject.name == "BoundsRight"){
			atBoundsRight = false;
		}
		else
		{
			atBoundsLeft = false;
		}
	}
}

If it works, it works :slight_smile:

The way I did it was

function Update () {
    BlaBlaMovement ();

    transform.position.x = Mathf.Clamp (transform.position.x, minX, maxX);
}

But its completely different and doesn’t use triggers.