Part
A box, ball, cylinder or capsule: the building block of worlds.
- Inherits: BasePart → Instance
- Subclasses: SpawnLocation
- Creatable: Yes:
new Part(), orInstance.new('Part', parent). - Replication: Replicated: clients get a copy, and changes the server makes reach them.
A Part is a BasePart with a shape. Everything about position,
physics, touching and looks is inherited from BasePart.
Properties
Section titled “Properties”Type: PartShape · Default: 'box' · Access: read/write · Replicates: yes
The part’s shape. Spheres use size.x as their diameter. Cylinders and capsules stand upright:
size.y is their height and the smaller of size.x and size.z their diameter. In 2D games,
cylinders collide like boxes.
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”A row of steps
Section titled “A row of steps”import { Color3, Part, Vector3, workspace } from '@rally/sdk';
for (let i = 0; i < 10; i++) { const step = new Part(); step.name = `Step${i + 1}`; step.size = new Vector3(6, 1, 6); step.position = new Vector3(0, 2 + i * 3, i * 8); step.color = Color3.fromHSV(i / 10, 0.7, 0.9); step.material = 'smooth'; step.parent = workspace;}