PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

RespawnLocation

Player

SpawnLocation

If set, the player will respawn at the given SpawnLocation. This property can only be set through Lua and must contain a reference to a valid SpawnLocation, which must meet the following criteria:

  • Descendant of Workspace
  • SpawnLocation/TeamColor|SpawnLocation.TeamColor is set to the Player/TeamColor|Player.TeamColor or SpawnLocation/Neutral|SpawnLocation.Neutral is set to true

If RespawnLocation is not set to a valid SpawnLocation then the default spawning logic will apply. For more information on this see the page for SpawnLocation.

Alternatives to RespawnLocation

  • A Player will spawn from SpawnLocation|SpawnLocations belonging to their team. In some cases it may be simpler to change the Player|Player's Player/Team instead. This method also allows the Player to respawn from multiple SpawnLocation|SpawnLocations.
  • Developers may wish to implement their own custom spawn logic, using Model/SetPrimaryPartCFrame to move the Player/Character manually.


Code Samples


Change Spawn on Touch

This code sample will set the player to always respawn from the last SpawnLocation they touched. New players will respawn from the SpawnLocation named ‘FirstSpawn’ until they touch a different SpawnLocation.

This is an alternative to using the AllowTeamChangeOnTouch property to switch SpawnLocations and does not require Teams.