SpawnLocation
A part characters spawn on top of.
- Inherits: Part → BasePart → Instance
- Creatable: Yes:
new SpawnLocation(), orInstance.new('SpawnLocation', parent). - Replication: Replicated: clients get a copy, and changes the server makes reach them.
When a character spawns, the server uses the player’s
respawnLocation if it’s set and in the Workspace (any
part; a SpawnLocation only while enabled); otherwise it picks one of the enabled SpawnLocations in
the Workspace at random. The
character appears standing on top of it, up to 2 studs off its center along x and z, so players
spawning together don’t overlap. With no enabled SpawnLocation, characters appear at (0, 5, 0).
Properties
Section titled “Properties”enabled
Section titled “enabled”Type: boolean · Default: true · Access: read/write · Replicates: yes
Disabled spawn locations are never used, not even as a player’s respawnLocation.
SpawnLocation changes some inherited defaults: size is new Vector3(6, 1, 6), color is Color3.fromHex('#2c7afd').
Inherited from BasePart: position, rotation, size, color, material, transparency, anchored, canCollide, canTouch, castShadow, velocity, angularVelocity, density, friction, restitution, image
Inherited from Instance: name, archivable, id, className, parent, destroyed
Methods
Section titled “Methods”Inherited from BasePart: applyImpulse, getMass
Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString
Events
Section titled “Events”Inherited from BasePart: touched, touchEnded
Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged
Examples
Section titled “Examples”Checkpoints
Section titled “Checkpoints”import { Players, SpawnLocation, workspace } from '@rally/sdk';
// Touching a checkpoint makes it where you respawn.for (const d of workspace.getDescendants()) { if (!(d instanceof SpawnLocation)) continue; const checkpoint = d; checkpoint.touched.connect((other) => { const player = Players.getPlayerFromCharacter(other); if (player) player.respawnLocation = checkpoint; });}