Spawning objects with random sizes and random seperation

I'm trying to spawn spheres that are randomly separated and have random sizes. Right now my script just spawns one sphere and I get this error

"InvalidCastException: Cannot cast from source type to destination type. Particle Script.Start () (at Assets/Particle Script.js:10)"

Here is my script

var numberofpartices= 10;
var particles=transform;
var seperation= Random.Range (-10,10);
var particlemaxsize=5;

function Start () {

for (var i : int = 0;i < numberofpartices; i++) {
var numRandom: int = (Random.Range(0,10)+.5);
var particleMade: GameObject = Instantiate (particles, Vector3(i*seperation, 0, i*seperation), Quaternion.identity);
particleMade.transform.localScale= *numRandom;


how do I get it to spawn randomly sized and randomly spaced spheres? thanks for the help!

your second line is incorrect. instead of

var particles = transform;

you should have:

var particles : Transform;

then this object will have an exposed variable in the inspector called "particles". You will want to take your sphere prefab (you are using a prefab, right?), and place it in there. You can also change your Instantiate line to:

var particleMade = Instantiate(...);