Scene change on collision script?

So I got a script that’s supposed to change the scene when the player collides with a certain block but it does nothing. But, when I toggle “Is Trigger” on the box collider, it will load the level and nearly IMMEDIATELY go to the scene i’m trying to go to.

function OnTriggerEnter(other : Collider)

It’s javascript and the level name i’m trying to change to is called “message”.

The reason that your scene will load instantly, is probably because the character is colliding with the floor, which counts as OnTriggerEnter(). A way around this may be something like this:

function OnTriggerEnter(other : Collider) {
     if (other.gameObject.tag == "block") {

Now obviously you would need to change the level thats being loaded (change the ‘0’), but also you need to tag the certain block with the tag “block”, so that on a collision, if it detects a gameobject with the tag “block”, then it loads the level. I haven’t tested the code, but i’m sure some Googling would solve the problem. You could also try OnCollisionEnter(collision : Collision), and then do collision.gameObject.tag, but yet again I haven’t tested it.