OnTriggerEnter tripped by wrong objects

I would like the OnTriggerEnter function to be called only when tripped by an object with certain tags. Currently, any object, regardless of tag, seems to trip it. I don’t understand why.

Here’s the code:

var enemyDetectorFSM : PlayMakerFSM; //enemyDetectorFSM =

function OnTriggerEnter (other :
Collider) { if(other.gameObject.tag
== “attackElf” || “fatElf” || “fastElf” || “shortElf” || “smartElf”
|| “strongElf” || “toughElf” ||
“uglyElf” || “youngElf”) {
} }

Note: The code calls a playMaker functional state machine, but as that is all contained within the if statement, I don’t think it could be responsible for the OnTriggerEnter problem.

Thanks in advance for your help.

Your syntax in the if statement won’t work; you need to use

other.gameObject.tag == "attackElf" || other.gameObject.tag == "fatElf" // and so on

Just saying “fatElf” || “fastElf” etc. will always return true. (Also in the future please format code properly using the code format button, or else manually put 4 spaces in front of each line.)