assigning to a team

Hi all. I have a script that puts two ai teams against eachother. I put them into an array then have a number assigned to them. I just am not sure how to get the player into either team by selecting say red or blue team from the main menu. How do I do this? I’ll attach scripts when I can get to them at my computer if you need them! Thanks in advance!

It would be great to see the logic behind a team to see whether it’s applicable for a player or not. Basically to attach different scripts to different situations / selections you could use a drop-down menu, have a look at the PopupList on the Wiki.

Another example would be to have two buttons for selection:

private var teamSelected : boolean = false;
var player : gameObject;
function OnGui () {
    if(!teamSelected){
        if (GUILayout.Button(Rect(10,10,70,30), "Team Red")){
             player.AddComponent ("teamRedScript");
             teamSelected = true;
        }
        if (GUILayout.Button(Rect(10,50,70,30), "Team Blue")){
            player.AddComponent ("teamBlueScript");
            teamSelected = true;
        }
    }
}

You could also do a OnMouseDown on two 3d-models in the scene if you want a more visual style when selecting.

The basics though is to, at a given action, add a component. Have a look at AddComponent in the docs for usage.