Search the docs

Find a guide, global, type or member

GlobalEmber

teams

Named teams of players (at most 64, names 1 to 32 characters). A team's colour and prefix show on its members' names. Functions taking a team name raise if no such team exists.

Functions

teams.create(name: string, color: string?, prefix: string?)#

Creates a team. color is a named text colour ("red", "dark_aqua"); prefix is MiniMessage shown before members' names. Raises if the name is taken.

teams.delete(name: string) -> boolean#

Deletes a team, freeing its members. Returns whether it existed.

teams.exists(name: string) -> boolean#

Whether a team exists.

teams.names() -> { string }#

Returns every team name, in creation order.

teams.join(name: string, player: Player)#

Puts a player on a team, taking them off any other.

teams.leave(player: Player) -> boolean#

Takes a player off their team. Returns whether they were on one.

teams.of(player: Player) -> string#

Returns the player's team name, or nil.

teams.members(name: string) -> { Player }#

Returns the team's members who are still in the world.

teams.size(name: string) -> number#

Returns how many players are on the team.

teams.allies(a: Player, b: Player) -> boolean#

Whether both players are on the same team.

teams.setColor(name: string, color: string?)#

Changes or clears (nil) the team's colour.

teams.setPrefix(name: string, prefix: string?)#

Changes or clears (nil) the team's name prefix.

teams.setFriendlyFire(name: string, enabled: boolean)#

Records whether teammates may hurt each other (default false). The host does not enforce it: check friendlyFire in your playerDamage handler.

teams.friendlyFire(name: string) -> boolean#

Returns the team's friendly-fire flag.