rojo/.cursor/rules/roblox/reference/engine/classes/Teams.yaml
2026-02-02 12:08:47 -06:00

110 lines
4.1 KiB
YAML

# This file is automatically generated. Please don't edit it manually.
# To submit a bug report on the content, see
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
name: Teams
type: class
memory_category: Instances
summary: |
The Teams service holds a game's `Class.Team` objects. `Class.Team` objects
must be parented to the Teams service.
description: |
The Teams service holds a game's `Class.Team` objects. `Class.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 `Class.Model` will
be colored to the `Class.Team.TeamColor`
- Changing `Class.Player.TeamColor` will cause `Class.Player.Team` switch to
the Team with the corresponding `Class.Team.TeamColor`
- When using the default player list users will be grouped and displayed by
team
- Setting `Class.Player.Neutral` to true will cause the `Class.Player` to be
dis-associated with the team, but will not change `Class.Player.Team` or
`Class.Player.TeamColor`
- When a `Class.Player` joins a game, they will be allocated to the team with
`Class.Team.AutoAssignable` set to true that has the fewest players. If no
auto assignable team is available, `Class.Player.Neutral` will be set to
true
- When `Class.SpawnLocation.Neutral` is set to false, only players whose
`Class.Player.TeamColor` matches `Class.SpawnLocation.TeamColor` can spawn
on that `Class.SpawnLocation`
- When `Class.SpawnLocation.AllowTeamChangeOnTouch` is set to true, a player's
`Class.Player.TeamColor` will change to `Class.SpawnLocation.TeamColor` when
their character touches the `Class.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
code_samples:
- Team-Rebalance
- Team-Only-Door
- Team-Kill-Check
inherits:
- Instance
descendants: []
tags:
- NotCreatable
- Service
deprecation_message: ''
properties: []
methods:
- name: Teams:GetTeams
summary: |
Returns a table containing the game's `Class.Team` objects. Will only
return `Class.Team` objects that are parented to the `Class.Teams`
service.
description: |
The GetTeam function returns a table containing the game's `Class.Team`
objects.
Note this will only return Team objects that are directly parented to the
`Class.Teams` service. For this reason it is recommended developers only
parent `Class.Team` objects to the `Class.Teams` service and not to other
`Class.Instance|Instances` (or to each other).
code_samples:
- Teams-GetTeams
parameters: []
returns:
- type: Instances
summary: |
An array of `Class.Team|Teams` in the game.
tags: []
deprecation_message: ''
security: None
thread_safety: Unsafe
capabilities:
- Players
- name: Teams:RebalanceTeams
summary: |
Evens the number of people on each team. This function does not work
correctly and should not be used.
description: |
Evens the number of people on each team. This function does not work
correctly and should not be used.
code_samples: []
parameters: []
returns:
- type: ()
summary: ''
tags:
- Deprecated
deprecation_message: |
This function has been deprecated and no longer functions correctly. It
should not be used. Developers should instead implement their own team
sorting systems.
security: None
thread_safety: Unsafe
capabilities:
- Players
events: []
callbacks: []