How to instantiate Two color balls in opposite directions?

Hi All,
I have two color balls red and green, the balls should be instantiate at -x and x positions, and their target is center(0,0,0) translate. I instantiate balls randomly but i dont want this, i want, if red ball instantiate at -x position green ball should be instantiate at x position ,like that, not same color balls at same position(now i i have this) ,so i want some coed line to achieve this.thanks.
“If my question is not clear replay me.”

in C# or in Jscript?

Anyways, here is the Jscript “example”:

#pragma strict

    var Ball : GameObject; //A normal ball, with a material
    var X : int;            //The x value
    var Color1 : Color;    //The first color(green)
    var Color2 : Color;    //The second color(red)

function Start () {
    //Instantiate
    var FirstBall = GameObject.Instantiate (Ball, Vector3 (X, 0, 0), Quaternion.identity);
    var SecondBall = GameObject.Instantiate (Ball, Vector3 (-X, 0, 0), Quaternion.identity);
    //Setting the colors
    Color1 = new Color (0, 255, 0);
    Color2 = new Color (255, 0, 0);
    //Applying colors
    FirstBall.GetComponent(Renderer).material.color = Color1;
    SecondBall.GetComponent(Renderer).material.color = Color2;

    //And here, or in the Update function you need to move the balls, and you're done

}

And here’s the same thing, except in C#:

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

    Transform Ball; //A normal ball, with a material
    int X;            //The x value
    Color Color1;    //The first color(green)
    Color Color2;    //The second color(red)

    void Start () {
        //Instantiate
        GameObject FirstBall = (GameObject)GameObject.Instantiate (Ball, new Vector3 (X, 0, 0), Quaternion.identity);
        GameObject SecondBall = (GameObject)GameObject.Instantiate (Ball, new Vector3 (-X, 0, 0), Quaternion.identity);
        //Setting the colors
        Color1 = new Color (0, 255, 0);
        Color2 = new Color (255, 0, 0);
        //Applying the colors
        FirstBall.GetComponent<Renderer> ().material.color = Color1;
        SecondBall.GetComponent<Renderer> ().material.color = Color2;

        //And here, or in the Update function you need to move the balls, and you're done

    }

}

I hope i could help

Edit:
Both codes where wrong, but i fixed them, and they’re working fine

Thx For ur replay. But i dont want this.
I have two color balls prefabs. what i want is , if red ball is instantiate at -x position then green ball should instantiate at x position, if green ball instantiate -x position then red should at +x position. the both balls are instantiate at opposite direction and translate to center .like that .

Okay, jscript or C# beacause i’m not going to write the whole thing twice

Sorry for that, c#.
i just want that condition same color ball should not instantiate at same position.

#pragma strict

    String FirstBallTag;
    String SecondBallTag;
    GameObject FirstBall;
    GameObject SecondBall;

void Update () {
    if(!(GameObject.FindGameObjectWithTag(FirstBallTag) != null && GameObject.FindGameObjectWithTag(SecondBallTag) != null)){
        if (GameObject.FindGameObjectWithTag(FirstBallTag) != null) {
            GameObject.Instantiate(SecondBall, -GameObject.FindGameObjectWithTag(FirstBallTag).transform.position, Quaternion.identity);
           
        } else if (GameObject.FindGameObjectWithTag(SecondBallTag) != null) {
            GameObject.Instantiate(FirstBall, -GameObject.FindGameObjectWithTag(SecondBallTag).transform.position, Quaternion.identity);
           
        }
    }
}

You need to assign a different tag to both Object and assign the prefabs and these tags to the script

And if the Sphere’s are already in the scene, you can use this code, to keep them mirrored

using UnityEngine;
using System.Collections;

public class Test : MonoBehaviour {

    public GameObject FirstBall;
    public GameObject SecondBall;
    private Vector3 FirstPos;
    private Vector3 SecondPos;
   
    void Update () {
        if (FirstBall.transform.position != FirstPos) {
            SecondBall.transform.position = -FirstBall.transform.position;
        } else if (SecondBall.transform.position != SecondPos) {
            FirstBall.transform.position = -SecondBall.transform.position;
        }
        SecondPos = -FirstBall.transform.position;
        FirstPos = -SecondBall.transform.position;
    }

}

Thanks. ill try this.