If X coordinate = Value then change position

I have a camera that follows a ball and move along the X axis only. When the ball reaches this one area I want my camera to zoom out by -10 coordinates so it shows further away but as I am new to coding my attempts have been in vain.

Upon researching this is I’ve found snippets of information relating to other things and tried to compile them but to no avail I’m at a loss.

Edited code -

var target : Transform; //Variable for the position of an item
var distance = -10;
var lift = 1.5;

function Update () 
{
	transform.position = target.position + Vector3(0, lift, distance); //Camera position should be equal to target position with the variables added on

	transform.LookAt (target); //Always look at target
}

function OnTriggerEnter (collided : Collider)
{
	if (collided.gameObject.tag == "ZoomOut")
 		{       
            Debug.Log("Zoom");
 			distance = distance * 10;
  	    }   
}

The debug.log doesnt show even though the collider is set a trigger and tagged as “ZoomOut” and the distance doesnt change.

Thanks for the help everyone I can’t seem to figure this out so I’m going to rewrite using a different method.

To to use a trigger. Create an empty game object, stick a Box collider on it with the trigger tick box set. Resize and place where you want the trigger zone and add a script with the OnTriggerEnter function. Make sure your ball has a collider and a RigidBody to ensure the trigger is activated.

Looks like

transform.position = Vector3(0,-10,0);

should be

cameraPosition = Vector3(0,-10,0);

var target : Transform;

var distance = -10;

var lift = 1.5;

function Update () 
{ 
transform.position = target.position + Vector3(0, lift, distance);

    transform.LookAt (target);
}

function OnTriggerEnter (collided : Collider) 
{ 
if (collided.gameObject.tag == "ZoomOut")

    {       
            Debug.Log("Zoom");
 
    distance = distance * 10;
    }