stopping animal from growing once it reaches a certain size.

Hi guys,
I’m trying stop a creature from getting bigger and I’m not sure how to do it or fix the errors I’m getting. If anyone could help that would be fantastic and much appreciated.

var growth : GameObject;
var Value : float;
var scle;
var CsScript:Detonator;
var size: Transform;

function Awake(){
	CsScript = this.GetComponent("Detonator");
	size = growth.transform.lossyScale;
	}

function Update () {
	if(Time.timeScale == 1.0){ //if the game is paused or on the menu the horse won't move
		if(size.position.x < 2){ //if the horse is still small enough
			scle = Value/1000; //gives me a value i can work with
			growth.transform.localScale += Vector3(scle,scle,scle);
                    //increases the size of the horse
			}
		else{
			Blow(); //explodes if it is too big
		 }
	}
}

function OnGUI(){
	if (MainCode.Attrib == true){
		Value = GUI.HorizontalScrollbar (Rect (25, 25, 100, 30), Value, 1.0, 0.0, 10.0);
	}
}
function Blow(){
	CsScript.Explode();
			}

The problem I keep getting is as follows:
Assets/Growth.js(10,33): BCE0022: Cannot convert ‘UnityEngine.Vector3’ to ‘UnityEngine.Transform’.

The problem is exactly as described in the error message. It is not possible to convert a ‘Vector3’ to a ‘Transform’.

This occurs in the awake function:

function Awake()
{
    CsScript = this.GetComponent("Detonator");
    size = growth.transform.lossyScale; // This line is an error
}

My guess from reading the code is that you want to actually store the transform. So change the awake function to:

function Awake()
{
    CsScript = this.GetComponent("Detonator");
    size = growth.transform;
}

That should fix your problem.