PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Player Spawns and Teams

Player Spawns and Teams

Aug 22 2019, 4:19 PM PST 10 min

In Roblox, SpawnLocation objects are used to position player characters when they start the game or respawn. They can also be used to spawn players of different teams at specific locations.

Inserting a Spawn

To insert a spawn in Studio, select the Model tab and click the Spawn button:

Hiding the Spawn Block

If desired, you can “hide” the SpawnLocation object as follows:

  1. Make it invisible by setting its Transparency property to 1.
  2. Turn off its CanCollide property so players don't appear to be standing on nothing.
  3. Delete its child Decal object.

Disabling the Force Field

By default, characters will spawn with a 10-second ForceField which protects them from basic “spawn killing.” However, the built-in protection is limited to Explosion|Explosions and damage dealt via Humanoid/TakeDamage|Humanoid:TakeDamage(), not by scripts that reduce Humanoid/Health directly.

To disable the force field completely, set the spawn’s ForcefieldDuration property to 0.


Implementing Teams

The Teams service adds team functionality and is closely tied to player spawns. Team names and colors, along with all the players on that team, are visible on the in-game articles/Leaderboards|leaderboard.

Adding the Teams Service

The Teams service isn’t included in a game by default, so you must add it.

  1. With the Model tab still selected, click the Service button () in the Advanced section.
  2. Select Teams and click Insert. When complete, the Explorer will get a new object called Teams.

Adding New Teams

With the Teams service added, you can create a new team by hovering over the Teams object, clicking the icon, and selecting Team.

Once the team has been added:

  1. Change the team’s Name to a suitable value.
  1. Assign the team a unique TeamColor, a setting which works in direct conjunction with SpawnLocation objects.

Configuring Spawns

By default, spawn locations are neutral, meaning any player can spawn upon them. In most games, however, teams should be separated by distinct “territories” or a physical barrier like a articles/Collision Filtering Team Doors|team door.

To lock a spawn location to a specific team:

  1. Select the SpawnLocation object.
  2. In the Properties window, disable its Neutral property.
  3. Set its TeamColor property to the color of the associated team you created above.

Player Assignment

By default, Roblox will auto-assign new players to the team with the fewest players. To assign players to a specific team and spawn location which you’ve configured:

  1. Select each Team object in the Teams service and disable its Team/AutoAssignable|AutoAssignable property.
  1. Assign a player to a specific team by changing his/her Player/Team property to the team name, for instance Teams["Blue Team"]. This can be done in various ways, for instance a team selection GUI as exhibited in the Team Picker sample below, or a lobby with different articles/How to teleport within a Place|teleporters that assign players to teams.

Team Picker Sample

Choose among four teams from a GUI picker and spawn at the team's respective spawn location.
Tags:
  • spawn
  • team