Do a collider only with certain taged objects

Hi, I have done a little rutine to detect players that collide on a certain area, but I have the problem that monsters can enter too… So I want only to detect objects with the tag player:

Here is my code:

function OnTriggerEnter(Player : Collider) {
	if (numeroDePersonasEnElTanque==0){
		isPlayerVisible = true;
		playerTriggered=Player.gameObject.transform;
	}
	else{
		isPlayerVisible  = false;
		playerTriggered=null;
	}
}

What function should I use to solve it?

if (player.gameObject.tag == “Player”) {…} or use CompateTag()

You can use GameObject.CompareTag - look at:

http://unity3d.com/support/documentation/ScriptReference/GameObject.CompareTag.html

That’s the example they show:

// Immediate death trigger.
// Destroys any colliders that enter the trigger, if they are tagged player.
function OnTriggerEnter (other : Collider) {
if (other.gameObject.CompareTag ("Player")) {
Destroy (other.gameObject);
}
}