MeshPart
A part that shows a 3D model loaded from a .glb or .gltf file.
- Inherits: BasePart → Instance
- Creatable: Yes:
new MeshPart(), orInstance.new('MeshPart', parent). - Replication: Replicated: clients get a copy, and changes the server makes reach them.
Each player’s device downloads the model and fits it to the part: scaled to size (times
meshScale) and centered on it. Until the model has loaded, or if it can’t be loaded, the part
draws as a box; a failed load also writes a warning to the game’s output.
The model keeps its own materials, so color and material don’t change how it looks. For
physics, a MeshPart is a box of its size.
Properties
Section titled “Properties”meshUrl
Section titled “meshUrl”Type: string · Default: '' · Access: read/write · Replicates: yes
URL of a .glb or .gltf file. Players’ devices download it.
meshScale
Section titled “meshScale”Type: Vector3 · Default: new Vector3(1, 1, 1) · Access: read/write · Replicates: yes
Scales the model inside its box.
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”Place a model
Section titled “Place a model”import { MeshPart, Vector3, getChild, ServerStorage, workspace } from '@rally/sdk';
// A MeshPart prepared in Rally Studio and kept out of the world until it's needed.const template = getChild(ServerStorage, 'Tree', MeshPart);const tree = template.clone();tree.position = new Vector3(20, tree.size.y / 2, -12);tree.parent = workspace;