Reversing an objects movement.

So I’m trying to make my first game and want a fish to reverse it’s direction near the end of the screen. To change it’s direction I’ve tried altering the variables speed so it moves the other way but not joy. Does any one have any suggestions.

//Inspector Variables
var fish01Speed = 5;



function Update () {

//Starts Movement
transform.Translate(Vector3.up * fish01Speed * Time.deltaTime);

//Checks for walls
if(transform.position.x >= 12)
	{
	 var fish01Speed = -5;
	}

}

You are close, but one problem with your script.
In the check for walls you have var fish01Speed = -5;
Remove the var keyword and it should work. having this keyword there creates a new variable fish01Speed which context is limited to the remainder of the if statement.