Combat System unity 4.3

Hello im testing Combat system script but i have this errors.

MissingComponentException: There is no ‘GUIText’ attached to the “CombatText(Clone)” game object, but a script is trying to access it.
You probably need to add a GUIText to the game object “CombatText(Clone)”. Or your script needs to check if the component is attached before using it.
Combat.Update () (at Assets/Scripts/JavaScript/Combat.js:23)

//----------------------------------------------------------------------
//Main Combat Text Script
//----------------------------------------------------------------------

private var scroll: float = 0.08; // scrolling velocity private var duration: float = 1.5; // time to die private var alpha: float;

private var alpha : float = 4.00;

private var duration : float = 1.50;

function Start(){

	guiText.material.color = Color(1,1,1,1.0);
	alpha = 1;
}

function Update(){

	if (alpha>0){

    	transform.position.y += scroll*Time.deltaTime; 
		alpha -= Time.deltaTime/duration; 
    	guiText.material.color.a = alpha; 
	} else {
    	Destroy(transform.gameObject);
	}
}

any help?

REfresh help please

The error literally tells you exactly how to fix this problem. Don’t think anyone can help you any better.

You probably need to add a GUIText to the game object “CombatText(Clone)”. Or your script needs to check if the component is attached before using it.

1 Like