MoveTowards doesn't work after changing tag.

Hi, I have a ship tagged “Player” that gets followed by the boomer objects, that part works perfectly, and when the player loads the cargo, tag changes to “ShipLoaded” as intended, but the boomers no longer follow the player, even tho I specified to choose from tags “Player” || “ShipLoaded”, and the console reports NullReferenceException error in OnTriggerStay, on the “var targ” line.

What am I doing wrong?

#pragma strict

var speed : float = 4;
var closeEnough : boolean = false;

function Start()
{
}

function Update()
{
}

function OnTriggerStay(trig : Collider)
{
	rigidbody.isKinematic = false;
	if(((trig.gameObject.tag == "Player") || (trig.gameObject.tag == "ShipLoaded")) && (closeEnough == false))
	{
		var targ = GameObject.FindWithTag("Player" || "ShipLoaded");
    	transform.position = Vector3.MoveTowards(transform.position, targ.transform.position, speed * Time.deltaTime);
    }
}

function OnTriggerExit(trig : Collider)
{
	rigidbody.isKinematic = true;
}

var targ = GameObject.FindWithTag(“Player” || “ShipLoaded”);

You can’t use logical or this way.

what your looking for in you onTriggerStay() is

var targ : Transform;
var _trans : Transform;

function Start(){
    _trans = transform;
}
//...
function OnTriggerStay(trig:collider){
    if((targ == null) && ((trig.tag == "Player") || (trig.tag == "ShipLoaded")) && (closeEnough == false)){
         var targ = trig.transform;
    }
    if(targ != null){
         trans .position = Vector3.MoveTowards(_trans.position, targ.position, speed * Time.deltaTime);
    }
}
function OnTriggerExit(trig:collider){
    if(((trig.tag == "Player") || (trig.tag == "ShipLoaded")) && targ != null){
        targ = null;
    }
}

this should not only do what you want, but also be better in terms of performance as well.