No idea why this collision isn't working

I have a powerup as a prefab, it has a collider attached to it aswell as this script. For some reason when my player runs into it there is no message in the log and I have no idea why? I looks to me like the syntax is correct and it returns no errors. You guys have any idea?

function OnCollisionEnter(collision : Collision){
if (collision.gameObject.name == "FakePlayer") {
        Debug.Log("HitPowerup");
   
    }
}

I am just guessing here, but make sure that both the powerup and your player has some way to detect collision (rigidbody recommended for the player).

The script looks fine to mee, but I am not that into Javascript…

From your code I can think of only 2 reasons why this might be happening ( i happen to have stumbled upon both of them at some point or another :slight_smile: )

  1. Your prefab Collider might be marked as a trigger. If you can pass through the prefab then that’s what the problem should be.

  2. It is actually the the tag which is fake player and not the name.