gui texture wrapping, how to stop?

So, i have a script that makes the guiTexture follow an enemy on screen. When i turn my back to the enemy, the guitexture comes back around! I want the guiTexture to disappear when the enemy is not onscreen. Any help? And by the way, here’s the script:

var target : Transform;
var texture : GUITexture;
var changeDistance = 5.0;
var offset = Vector2.zero;
var getHit = false;
var getHitScript : GameObject;
private var origwidth = 0;
function Start (){
origwidth = texture.pixelInset.width;	

function Update () {
	
	
	// define a few updated variables...
	var gh = getHitScript.GetComponent("GetHit");
    var screenPos : Vector2 = camera.main.WorldToScreenPoint (target.position);

    texture.pixelInset.x = screenPos.x + offset.x;
    texture.pixelInset.y = screenPos.y + offset.y;

    // Control the crosshair's position on the screen:

    if (getHit){
    texture.pixelInset.width = origwidth *(gh.totalHealth/100.0);
    texture.color.r = 50.0/gh.totalHealth;
	texture.color.g = gh.totalHealth/50.0;
    }
    
}

oh, by the way, you can ignore all the getHit stuff, that’s for another script-
Thanks in advance!

-Stopsecret Design

There’s probably better ways to do it but you can check if target is on screen by checking the renderer’s ‘isVisible’ http://unity3d.com/support/documentation/ScriptReference/Renderer-isVisible.html
And just don’t show the guitext when it’s not visible

WorldToScreenPoint returns a Vector3. The 3rd (z) is the distance from the screen, with negative meaning behind you. So:

var screenPos : Vector3 = .....
if(screenPos.z>=0) { // use it