3.4 KiB
| title | description |
|---|---|
| Implement teams | The Teams service allows you assign players to different teams within your experience. |
You can divide players in your experience into multiple teams using the Class.Teams service. By configuring the Class.Teams service and assigning teams, players are automatically differentiated by their display name color, as well as their name in the default player list.
Add teams
By default, no teams are configured. To add teams:
-
In the Explorer hierarchy, hover over the
Class.Teamsobject and click the ⊕ icon to show a list of objects. -
Insert a new
Class.Teamobject under theClass.Teamsservice.
-
Select the new
Class.Teamobject and, in the Properties window, change the teamClass.Team.Name|Nameand assign a unique matchingClass.Team.TeamColor|TeamColor. A team's name and color both appear in the experience's player list.
-
Repeat these steps to add more teams.
Assign players to teams
By default, Roblox auto-assigns new players joining the experience to the team with the fewest members, and you can still use the following steps to assign players to a specific team.
-
Select each
Class.Teamobject in theClass.Teamsservice to display its properties. -
Uncheck the
Class.Team.AutoAssignable|AutoAssignablecheckbox.
-
Assign a player to a specific team by changing their
Class.Player.Teamproperty to the team name in the format ofTeams[TEAM_NAME], such asTeams["Blue Team"].
Team spawn locations
You can use Class.SpawnLocation objects to spawn players of different teams at specific locations when they join or respawn. By default, Class.SpawnLocation|SpawnLocations are neutral and any player can spawn upon them, so you need to lock each one to the team that can occupy it using the following steps:
-
Using the Explorer, insert a new
Class.SpawnLocationinto the workspace. -
With the new
Class.SpawnLocationselected, uncheck itsClass.SpawnLocation.Neutral|Neutralcheckbox in the Properties window. -
Set the spawn's
Class.SpawnLocation.TeamColor|TeamColorproperty to theClass.Team.TeamColor|TeamColorof an existing team. For example, if the intended team'sClass.Team.TeamColorisLapis, set the spawn'sClass.SpawnLocation.TeamColortoLapisas well.
`Class.Team.TeamColor`
`Class.SpawnLocation.TeamColor`