Help! loop problem

can someone tell my why this is only spawning an object once (on the first loop)

var my : boolean = true;
var baddy : GameObject;

function Start() {
   if (my) (
        Instantiate(baddy, transform.position, transform.rotation));
        my = false;
        yield WaitForSeconds(.5);
        my = true;
}

It's only spawning an object once, because `function Start()` is only called once, when the script instance is enabled.

You could simplify your code by using InvokeRepeating().

var baddy : GameObject;

function Start()
{
   InvokeRepeating("spawnBaddy", 0, 0.5);
// Invoke function "spawnBaddy", 0 second delay, 0.5 second repeat
}

function spawnBaddy()
{
        Instantiate(baddy, transform.position, transform.rotation));
}

Let me know if you have any troubles or queries!