There is not version of Destroy that takes a string as parameter. You have to pass an object here.
`Object` is a class, not a reference to a particular object so you can't use "`name`" of the class.
Just a side note: You don't have to write `Object` before Destroy. Only in classes that do not inherit from `UnityEngine.Object`. Anyways, it's not wrong so you can do this if it helps your understanding of your code.
If you want to remove this script from the gameobject use:
Destroy(this);
If you want to destroy the whole GameObject use:
Destroy(gameObject);
edit
The reason why this doesn’t work is that you can’t use coroutines with Invoke or InvokeRepeating. You can use a single coroutine to achieve your desired behaviour.
var blinkTime : int = 3; //How long the sphere will blink
function Start()
{
yield WaitForSeconds(1); // The initial delay that you passed to InvokeRepeating
while (blinkTime > 0)
{
blinkTime--;
yield WaitForSeconds(0.5);
renderer.enabled = false;
yield WaitForSeconds(0.5);
renderer.enabled = true;
}
yield WaitForSeconds(1); // wait another sec.
Destroy(gameObject);
}