Hi, How do I implement a team system in a multiplayer game? (eg : when you start a level,something like team deathmatch, you get to choose betwen two teams?( In JS) Thanks!
You can make a GUI script as the player join the game or server. Create two GUI buttons which shows 2 teams that the player would choose. If the player click on one of them, you can spawn a prefab(with a tag possibly) which links to the “TeamScore” script when kill someone.
This script is not tested:
var playerTeam1 : Transform;
var playerTeam2 : Transform;
var spawnpoint1 : GameObject;
var spawnpoint2 : GameObject;
function OnGUI () {
if (GUI.Button (new Rect(10, 10, 100, 30), "Team Name1")) {
Network.Instantiate(playerTeam1, spawnpoint1.transform, spawnpoint1.rotation);
}
if (GUI.Button (new Rect(10, 50, 100, 30), "Team Name2")) {
Network.Instantiate(playerTeam2, spawnpoint2.transform, spawnpoint2.rotation);
}
}