Skip to content

BasePart

The base class of everything physical in the world: Part, SpawnLocation and MeshPart.

  • Inherits: Instance
  • Subclasses: MeshPart, Part
  • Creatable: No. It’s an abstract base class: create one of its subclasses, and check for it with instanceof or isA('BasePart').
  • Replication: Replicated: clients get a copy, and changes the server makes reach them.

A part only exists physically while it’s in the Workspace. Parts are anchored by default: they stay where you put them, which is right for floors, walls and platforms. Set anchored = false to let a part fall, roll, bounce and be pushed. Physics runs on the game server; players see unanchored parts move through replication.

In a 2D game parts live on the X/Y plane: position.z only decides what draws in front, physics ignores depth, and only rotation.z turns a part.

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

Center of the part, in studs.

Scripts can move anchored parts by setting position (or rotation): the part jumps there each step, which is how moving platforms and doors work. Characters standing on a part that moves move with it.

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

Rotation in degrees around X, Y, Z. 2D games use Z only.

The angles apply in X, then Y, then Z order.

Type: Vector3 · Default: new Vector3(4, 1, 2) · Access: read/write · Replicates: yes

Width, height, depth in studs.

How each shape uses it is described under Part.shape.

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

The part’s color. It also tints image when one is set.

Type: Material · Default: 'plastic' · Access: read/write · Replicates: yes

How the surface looks. It changes only the look: physics uses friction, density and restitution.

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

0 is solid, 1 is invisible.

A part with a transparency of 0.999 or more isn’t drawn, but it still collides; set canCollide = false for that.

Type: boolean · Default: true · Access: read/write · Replicates: yes

Anchored parts never move by physics. Set false to let it fall, roll and be pushed.

Anchored parts can still be moved by scripts (see position).

Type: boolean · Default: true · Access: read/write · Replicates: yes

Whether other parts and characters bump into it. When false, things pass through the part and raycasts ignore it, but it still fires touched (if canTouch is on): use that for checkpoints, coins and trigger zones.

Type: boolean · Default: true · Access: read/write · Replicates: yes

Whether the part fires touched and touchEnded. Turn it off on scenery nothing needs to touch.

Type: boolean · Default: true · Access: read/write · Replicates: yes

Whether the part casts a shadow in 3D games when Lighting.shadows is on. Parts with a transparency of 0.5 or more never cast one.

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

Studs per second (unanchored parts). Setting it launches the part.

Physics only moves unanchored parts, and only on the game server: set it from a server script.

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

Radians per second around each axis.

Like velocity, it only affects unanchored parts, on the server.

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

Mass per cubic stud: getMass() is volume × density. Heavier parts push lighter ones around and need more force to move.

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

How much the surface resists sliding: 0 slides freely, higher values grip more.

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

Bounciness: 0 doesn’t bounce, 1 bounces the most.

Type: string · Default: '' · Access: read/write · Replicates: yes

Texture URL drawn on the part (the sprite in 2D games).

Each player’s device loads it. Fully transparent pixels aren’t drawn, so PNG sprites with transparency work. On patterned materials (wood, grass, sand, brick) the image replaces the pattern.

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

applyImpulse(impulse: Vector3): void

Pushes an unanchored part (mass × change in velocity).

Only unanchored parts on the game server react: on players’ devices, and on anchored parts, it does nothing.

getMass(): number

Volume × density.

It uses the box volume (size.x × size.y × size.z) whatever the shape.

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: other: Instance

Fires on the server when a character or another part starts touching this one.

When a character touches the part, the argument is the Character. Parts touch when at least one of them is unanchored and moving: two anchored parts never touch. It fires once when contact starts, not every frame; use touchEnded to know when it stops.

Arguments: other: Instance

Fires on the server when something stops touching this part. The argument is what was touching it.

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

import { Character, Part, getChild, workspace } from '@rally/sdk';
const lava = getChild(workspace, 'Lava', Part);
lava.touched.connect((other) => {
if (other instanceof Character) other.kill();
});
import { Part, Vector3, task, workspace } from '@rally/sdk';
const ball = new Part();
ball.shape = 'sphere';
ball.size = new Vector3(2, 2, 2);
ball.position = new Vector3(0, 20, 0);
ball.anchored = false;
ball.restitution = 0.8;
ball.velocity = new Vector3(0, 0, 40); // launch it, in studs per second
ball.parent = workspace;
task.delay(10, () => ball.destroy());