Help. (Null reference exeption)

Help. I have a script, but he not working. It says Null reference exeption at second instantiate command(string 26).
In the first time i set the instantiate variable as transform. But now it isn’t work.
Script:826190–30752–$Eggggg.js (854 Bytes)
Please, help, and tell me, why it is happening.

Wrong forum. Try scripting.

Whoops

Hi liver, try this instead:

var radius = 5.0;
var power = 250.0;
var sparks : GameObject;
private var boomSound : GameObject;

function Start() {
boomSound = GameObject.Find("BoomSound") as GameObject;
InvokeRepeating("Blaboom",5,5);
}

function Blaboom () {
    // Applies an explosion force to all nearby rigidbodies
    var explosionPos : Vector3 = transform.position;
    var colliders : Collider[] = Physics.OverlapSphere (explosionPos, radius);
    
    for (var hit : Collider in colliders) {
        if (!hit)
            continue;
        
        if (hit.rigidbody)
            hit.rigidbody.AddExplosionForce(power, explosionPos, radius, 1.2);
            Instantiate(sparks, transform.position, transform.rotation);
            boomSound.audio.Play();
            Destroy(hit.gameObject); 
    }
}

This should work, if you have any questions feel free to ask.