Reference API Roblox

Engine API

Website

Related

Reference API Roblox

WeldConstraint

Connects two BaseParts together such that their relative position and orientation remain the same.

Member index 9

HistoryMember
553Active: bool
553Enabled: bool
553Part0: BasePart
553Part1: BasePart
inherited from Instance
553Archivable: bool
635Capabilities: SecurityCapabilities
553Name: string
553Parent: Instance
635Sandboxed: bool
616UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
486GetDescendants(): Array
486GetFullName(): string
641GetStyled(name: string): Variant
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
580IsPropertyModified(name: string): bool
573Remove(): null
576RemoveTag(tag: string): null
580ResetPropertyToDefault(name: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
648children(): Instances
553clone(): Instance
573destroy(): null
553findFirstChild(name: string, recursive: bool = false): Instance
648getChildren(): Instances
553isDescendantOf(ancestor: Instance): bool
573remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
553childAdded(child: Instance)
inherited from Object
647ClassName: string
647className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
650isA(className: string): bool
647Changed(property: string)

Description

WeldConstraint connects two BaseParts and ensures they stay in the same relative position/orientation to each other, meaning that if one part moves, the other moves the same amount. Even if the two parts are not touching, they can be welded together.

The most common way to create a weld constraint is by selecting Weld through Studio's Create menu in the Model tab.

Constraint picker indicated in Studio toolbar

Note that this tool behaves differently depending on how many BaseParts are selected when the tool is activated:

Repositioning Behavior

Moving a welded BasePart behaves differently depending on whether the part was moved through its Position or through its CFrame.

  • If a welded part's Position is updated, that part will move but none of the connected parts will move with it. The weld will recalculate the offset from the other parts based on the moved part's new position.

  • If a welded part's CFrame is updated, that part will move and all of the connected parts will also move, ensuring they maintain the same offset as when the weld was created.

History 29

Members 9

Active

TypeDefault
boolfalse

True if the WeldConstraint is currently active in the world.

If the WeldConstraint or one of its parts is not in Workspace the weld will be inactive.

Rigid joints like Weld, Snap, WeldConstraint, Motor, or Motor6D may also be disabled due to conflicts with other rigid joints, such as joints between the same two parts or indirect cycles in the weld graph. Joints disabled this way may be re-enabled later when another joint or part is added or removed.

Duplicate WeldConstraints do not conflict because WeldConstraints derive their internal CFrames from the relative positions of their parts when they are enabled and all update when BasePart.Position or BasePart.Orientation is set on a part. The spanning tree may still disable them if they are redundant or form a cycle.

This property is not replicated. Its interface does not cross the network boundary.
This property is read-only. Its value can be read, but it cannot be modified.

History 4

Tags: [ReadOnly, NotReplicated]

Enabled

TypeDefault
booltrue

The Enabled property of a WeldConstraint sets whether the constraint is active or not. When this property is set to true, if the constraint's WeldConstraint.Part0 and WeldConstraint.Part1 properties are set, then the constraint will ensure that its two connected parts will be locked together.

This property is not replicated. Its interface does not cross the network boundary.

History 6

Tags: [NotReplicated]

Part0

TypeDefault
BasePart

The Part0 and WeldConstraint.Part1 properties of a WeldConstraint set which two BasePart the weld connects. As soon as both properties are set and the weld is WeldConstraint.Enabled, the weld will lock the two parts together.

If Part0 or Part1 are ever set to new parts, then the WeldConstraint will instantly link the new part. The old part will no longer be constrained.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
local partA = Instance.new("Part")
local partB = Instance.new("Part")

partA.Position = Vector3.new(0, 10, 0)
partA.Parent = workspace

partB.Position = Vector3.new(0, 10, 10)
partB.Parent = workspace

local weld = Instance.new("WeldConstraint")
weld.Part0 = partA
weld.Part1 = partB
weld.Parent = partA
This property is not replicated. Its interface does not cross the network boundary.

History 5

Tags: [NotReplicated]

Part1

TypeDefault
BasePart

The WeldConstraint.Part0 and Part1 properties of a WeldConstraint set which two BasePart the weld connects. As soon as both properties are set and the weld is WeldConstraint.Enabled, the weld will lock the two parts together.

If Part0 or Part1 are ever set to new parts, then the WeldConstraint will instantly link the new part. The old part will no longer be constrained.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
local partA = Instance.new("Part")
local partB = Instance.new("Part")

partA.Position = Vector3.new(0, 10, 0)
partA.Parent = workspace

partB.Position = Vector3.new(0, 10, 10)
partB.Parent = workspace

local weld = Instance.new("WeldConstraint")
weld.Part0 = partA
weld.Part1 = partB
weld.Parent = partA
This property is not replicated. Its interface does not cross the network boundary.

History 5

Tags: [NotReplicated]

Settings