# Constraint

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Subclasses: [AlignOrientation](https://rapi.sleaze.dev/classes/AlignOrientation.md), [AlignPosition](https://rapi.sleaze.dev/classes/AlignPosition.md), [AngularVelocity](https://rapi.sleaze.dev/classes/AngularVelocity.md), [AnimationConstraint](https://rapi.sleaze.dev/classes/AnimationConstraint.md), [BallSocketConstraint](https://rapi.sleaze.dev/classes/BallSocketConstraint.md), [HingeConstraint](https://rapi.sleaze.dev/classes/HingeConstraint.md), [LinearVelocity](https://rapi.sleaze.dev/classes/LinearVelocity.md), [LineForce](https://rapi.sleaze.dev/classes/LineForce.md), [PlaneConstraint](https://rapi.sleaze.dev/classes/PlaneConstraint.md), [RigidConstraint](https://rapi.sleaze.dev/classes/RigidConstraint.md), [RodConstraint](https://rapi.sleaze.dev/classes/RodConstraint.md), [RopeConstraint](https://rapi.sleaze.dev/classes/RopeConstraint.md), [SlidingBallConstraint](https://rapi.sleaze.dev/classes/SlidingBallConstraint.md), [SpringConstraint](https://rapi.sleaze.dev/classes/SpringConstraint.md), [Torque](https://rapi.sleaze.dev/classes/Torque.md), [TorsionSpringConstraint](https://rapi.sleaze.dev/classes/TorsionSpringConstraint.md), [UniversalConstraint](https://rapi.sleaze.dev/classes/UniversalConstraint.md), [VectorForce](https://rapi.sleaze.dev/classes/VectorForce.md)
- Tags: Not creatable
- Memory category: BaseParts
- HTML page: https://rapi.sleaze.dev/classes/Constraint/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/Constraint

The base class for constraint-based objects.

## Properties

### Color

```luau
Constraint.Color: BrickColor
```

- Tags: Read capabilities: Physics

The color of the constraint.

### Visible

```luau
Constraint.Visible: boolean
```

- Tags: Read capabilities: Physics

Toggles the constraint's visibility.

### Attachment0

```luau
Constraint.Attachment0: Attachment
```

- Tags: Read capabilities: Physics, Simulation access

The [`Attachment`](https://rapi.sleaze.dev/classes/Attachment.md) that is connected to [`Constraint.Attachment1`](https://rapi.sleaze.dev/classes/Constraint.md).

### Attachment1

```luau
Constraint.Attachment1: Attachment
```

- Tags: Read capabilities: Physics, Simulation access

The [`Attachment`](https://rapi.sleaze.dev/classes/Attachment.md) that is connected to [`Constraint.Attachment0`](https://rapi.sleaze.dev/classes/Constraint.md).

### Active

```luau
Constraint.Active: boolean
```

- Tags: Read only, Read capabilities: Physics, Simulation access

Indicates if the constraint is currently active in the world.

### Enabled

```luau
Constraint.Enabled: boolean
```

- Tags: Read capabilities: Physics, Simulation access

Toggles whether or not the constraint is enabled.

## Methods

### GetDebugAppliedForce

```luau
Constraint:GetDebugAppliedForce(bodyId: number): Vector3
```

- Tags: Deprecated, Capabilities: Physics

**Deprecated:** This method should not be used in new work.

### GetDebugAppliedTorque

```luau
Constraint:GetDebugAppliedTorque(bodyId: number): Vector3
```

- Tags: Deprecated, Capabilities: Physics

**Deprecated:** This method should not be used in new work.

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
