Teams
Memory category | Instances |
---|
Member index 2
Description
The Teams service holds a game's Team objects. Team objects must be parented to the Teams service.
Teams offer a range of features that are useful to developers. These can broadly be divided into features that work out-of-the-box and features developers can program into their game.
Built-in team behavior The following functionality of Teams exists by default and does not require the developer to program any custom behavior.
- When part of a Team, the name above a player's character Model will be colored to the Team.TeamColor
- Changing Player.TeamColor will cause Player.Team switch to the Team with the corresponding Team.TeamColor
- When using the default player list users will be grouped and displayed by team
- Setting Player.Neutral to true will cause the Player to be dis-associated with the team, but will not change Player.Team or Player.TeamColor
- When a Player joins a game, they will be allocated to the team with Team.AutoAssignable set to true that has the fewest players. If no auto assignable team is available, Player.Neutral will be set to true
- When SpawnLocation.Neutral is set to false, only players whose Player.TeamColor matches SpawnLocation.TeamColor can spawn on that SpawnLocation
- When SpawnLocation.AllowTeamChangeOnTouch is set to true, a player's Player.TeamColor will change to SpawnLocation.TeamColor when their character touches the SpawnLocation
Optional extended team behavior Many developers chose to add the following features to teams in their own code.
- Implement checks for team in weapon code to prevent team killing
- Implement doors or other features that only certain teams can use
- Periodically reassign teams to maintain team balance
History 8
- 648 Change ReturnType of GetTeams from Objects to Instances
- 573 Change ReturnType of RebalanceTeams from void to null
- 462 Change ThreadSafety of RebalanceTeams from to Unsafe
- 462 Change ThreadSafety of GetTeams from to Unsafe
- 208 Change Tags of RebalanceTeams from [] to [Deprecated]
- 47 Add RebalanceTeams
- 47 Add GetTeams
- 47 Add Teams
Members 2
GetTeams
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
Instances |
The GetTeam function returns a table containing the game's Team objects.
Note this will only return Team objects that are directly parented to the Teams service. For this reason it is recommended developers only parent Team objects to the Teams service and not to other Instances (or to each other).
Thread safety | Unsafe |
---|
RebalanceTeams
Parameters (0) | ||
---|---|---|
No parameters. | ||
Returns (1) | ||
null |
Evens the number of people on each team. This function does not work correctly and should not be used.
Thread safety | Unsafe |
---|
History 4
- 573 Change ReturnType of RebalanceTeams from void to null
- 462 Change ThreadSafety of RebalanceTeams from to Unsafe
- 208 Change Tags of RebalanceTeams from [] to [Deprecated]
- 47 Add RebalanceTeams