Skip to content

Player

Someone in the game: one Player per connected person, inside Players.

  • Inherits: Instance
  • Creatable: No. The server creates one when someone joins.
  • Replication: Replicated: clients get a copy, and changes the server makes reach them.

When someone joins, the server creates their Player (named after their display name), copies StarterGui into their PlayerGui, fires Players.playerAdded and then spawns their character. When they leave, Players.playerRemoving fires and their Player and character are removed. Every player’s device sees every Player; each PlayerGui reaches only its own player.

Joining the same game again from somewhere else (another tab, say) removes the older connection.

Type: string · Default: '' · Access: read-only · Replicates: yes

Their Rally account id (stable across sessions).

Use it as the key for a player’s saved data. In Rally Studio’s Play it’s 'local'; on a Studio test server with several test players it’s 'test-1', 'test-2' and so on.

Type: string · Default: '' · Access: read-only · Replicates: yes

The name shown for them in the game, up to 32 characters. The Player’s name starts out the same.

Type: Character | null · Default: null · Access: read-only · Replicates: yes

Their current character, or null before their first spawn. After a death it’s the dead character until the next one spawns.

Type: Color3 · Default: Color3.fromHex('#2c7afd') · Access: read/write · Replicates: yes

The body color their characters spawn with.

Type: BasePart | null · Default: null · Access: read/write · Replicates: no

The part this player spawns on top of, such as their last checkpoint: a SpawnLocation (while it’s enabled) or any other part in the Workspace. When it’s null, a random enabled SpawnLocation is used. Server only: it isn’t sent to players’ devices.

Type: PlayerGui | undefined · Access: read-only

Their PlayerGui, or undefined if they don’t have one.

Inherited from Instance: name, archivable, id, className, parent, destroyed

loadCharacter(): void

Server: (re)spawns the character at a spawn location.

Replaces their current character, if any (characterRemoving fires first). Call it when Players.characterAutoLoads is off.

kick(message = 'You were removed from the game.'): void

Server: removes the player from the game with a message.

The message is cut to 500 characters.

Inherited from Instance: getPropertyChangedSignal, setAttribute, getAttribute, getAttributes, getAttributeChangedSignal, getChildren, getDescendants, findFirstChild, findFirstChildOfClass, findFirstChildWhichIsA, findFirstAncestor, findFirstAncestorWhichIsA, waitForChild, isA, isDescendantOf, isAncestorOf, getFullName, clearAllChildren, destroy, clone, toString

Arguments: character: Character

Fires when a new character spawns for this player, once it’s in the Workspace.

Arguments: character: Character

Fires before the player’s old character is replaced by a new one (a respawn or loadCharacter()).

Inherited from Instance: changed, childAdded, childRemoved, descendantAdded, descendantRemoving, ancestryChanged, destroying, attributeChanged

import { Player, Players, print } from '@rally/sdk';
const joinedAt = new Map<Player, number>();
Players.playerAdded.connect((player) => {
joinedAt.set(player, Date.now());
print(`${player.displayName} joined`);
player.characterAdded.connect((character) => {
character.walkSpeed = 20;
});
});
Players.playerRemoving.connect((player) => joinedAt.delete(player));