Skip to content

WeldConstraint

Rigidly joins two parts as they are right now: they keep their offset and move as one.

  • Inherits: Constraint → Instance
  • Creatable: Yes: new WeldConstraint(), or Instance.new('WeldConstraint', parent).
  • Replication: Replicated: clients get a copy, and changes the server makes reach them.

A weld keeps part1 where it is relative to part0 when the weld is created (or enabled again), and the two don’t collide with each other. Weld unanchored parts together to build vehicles and objects that fall or roll as one.

Inherited from Constraint: part0, part1, enabled

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

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

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

import { Part, Vector3, WeldConstraint, workspace } from '@rally/sdk';
const crate = new Part();
crate.size = new Vector3(4, 4, 4);
crate.position = new Vector3(0, 20, 0);
crate.anchored = false;
crate.parent = workspace;
const handle = new Part();
handle.size = new Vector3(1, 1, 3);
handle.position = new Vector3(0, 22.5, 0);
handle.anchored = false;
handle.parent = workspace;
const weld = new WeldConstraint();
weld.part0 = crate;
weld.part1 = handle;
weld.parent = crate; // they now fall as one