Disabling collider according to color?

I’m trying to make it so that if my player (a ball) rolls over a cube of a different color than the ball it falls through. I thought I’d be able to do this simply by checking if the color of the ball was equal to the color of the cube, but this doesn’t seem to be working.

This script is applied to the cube:

#pragma strict

var color:Color=Color.blue;
gameObject.renderer.material.color=color;
function OnTriggerEnter(bink:Collider){
	if ((bink.tag=="Player")&&(bink.renderer.material.color != color)){
		Disappear(5);
	}
}
function Disappear (runTime : float) {
    var timer = 0.0;
    while (timer < runTime) {
       gameObject.collider.enabled = false;
       timer += Time.deltaTime;
       yield;
    }
    gameObject.collider.enabled = true;
}

I don’t see a point in using the yield keyword. Get rid of it and you should get a working code, man

Try this:

var color:Color=Color.blue;
gameObject.renderer.material.color=color;

function OnCollisionEnter(col:Collision){
  if ((col.collider.tag=="Player")&&(col.collider.renderer.material.color != color)){
    StartCoroutine(disableCollisions(col.collider));
  }
}

function disableCollisions(bink:Collider)
{
  this.collider.enabled = false;
  yield WaitForSeconds (2);
  this.collider.enabled = true;
}