Skip to content

Character

A player’s body in the world.

  • Inherits: Instance
  • Creatable: No. The server creates one each time a player spawns (or loadCharacter() is called).
  • Replication: Replicated: clients get a copy, and changes the server makes reach them.

The server creates a character each time a player spawns, names it after the player and puts it in the Workspace. Its body is a capsule 5 studs tall with a radius of 1.

Each player moves their own character on their device, so movement feels instant, and sends its position 20 times a second. The server checks every move against walkSpeed and jumpPower and snaps the character back when a move goes too far. Physics doesn’t push characters: balls and explosions don’t knock them back.

Scripts on the server change a character through its properties: walkSpeed, jumpPower, health, teleport(). A character dies when health reaches 0 or it falls below workspace.fallenPartsDestroyHeight; it respawns after Players.respawnTime unless Players.characterAutoLoads is off.

Type: Vector3 · Default: new Vector3(0, 0, 0) · Access: read/write · Replicates: yes

Center of the body. Assigning it teleports the character.

The player’s device moves the character; the server’s value follows it. That device doesn’t receive position, rotation, velocity or state from the server: it is their source.

Type: Vector3 · Default: new Vector3(0, 0, 0) · Access: read/write · Replicates: yes

Facing, in degrees (y is the turn).

Type: Vector3 · Default: new Vector3(0, 0, 0) · Access: read-only · Replicates: yes

Velocity in studs per second, as the player’s device reports it.

Type: CharacterState · Default: 'idle' · Access: read-only · Replicates: yes

What the character is doing, as the player’s device reports it. It becomes 'dead' when health reaches 0.

Type: number · Default: 16 · Range: 0 to 200 (clamped) · Access: read/write · Replicates: yes

Studs per second.

New characters take it from StarterPlayer.characterWalkSpeed.

Type: number · Default: 50 · Range: 0 to 400 (clamped) · Access: read/write · Replicates: yes

Upward speed when jumping.

With the default gravity, 50 jumps about 6 studs high. New characters take it from StarterPlayer.characterJumpPower.

Type: number · Default: 100 · Range: 0 or more (clamped) · Access: read/write · Replicates: yes

Current health. When it reaches 0 the character dies: state becomes 'dead' and died fires. Nothing caps it at maxHealth.

Type: number · Default: 100 · Range: 1 or more (clamped) · Access: read/write · Replicates: yes

Full health. New characters start with health equal to it, from StarterPlayer.characterMaxHealth; the health bar over a character’s head shows health against it.

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

Body color.

New characters take their player’s teamColor.

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

The Player this character belongs to.

Static · Type: number · Access: read-only · Value: 1

Radius of the body’s capsule, in studs.

Static · Type: number · Access: read-only · Value: 5

Total height of the body’s capsule, in studs.

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

teleport(position: Vector3): void

Moves the character to position instantly (assigning position does the same). On the server, the player’s device is told to move it there too. Its velocity resets to zero.

takeDamage(amount: number): void

Lowers health by amount, not below 0. Does nothing if the character is already dead or amount isn’t a positive number.

kill(): void

Sets health to 0.

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: none

Fires once, when health drops to 0.

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

import { Character, Part, Vector3, getChild, workspace } from '@rally/sdk';
const spikes = getChild(workspace, 'Spikes', Part);
spikes.touched.connect((other) => {
if (other instanceof Character) other.takeDamage(25);
});
const pad = getChild(workspace, 'HealPad', Part);
pad.touched.connect((other) => {
if (other instanceof Character) other.health = other.maxHealth;
});
const portal = getChild(workspace, 'Portal', Part);
portal.touched.connect((other) => {
if (other instanceof Character) other.teleport(new Vector3(0, 50, 0));
});