Is there anything wrong with this script? It used to work but now it doesn't.

Hello. Here is my code:

var NormalBall : Rigidbody;

var BonusBall : Rigidbody;

function Start () {

}

function SpawnBall(){

var choice = Random.Range(1, 6);

if (choice == 1){

TypeOfBall = BonusBall;

}

else {

TypeOfBall = NormalBall;

}

var clone : Rigidbody;

clone = Instantiate(TypeOfBall, transform.position, transform.rotation);

}

It is supposed to randomly pick one of two balls to spawn and do so from a game object that this script is attached to. I have both balls set in that game object, but it is not spawning them. Any ideas? Thank you!

lolol, Didn't notice that the start function is empty...? he isn't even calling it ROFL, no wonder it isn't working xDD

function Start () {
SpawnBall();
}

You are not declaring TypeOfBall anywhere... you probably want to put:

private var TypeOfBall : Rigidbody;

Up top with your other declared vars.

Also, try to reserve CamelCase for functions and methods, and use camelCase from variables and properties... its good practice.