# Joint.setTargetLength

Sets the target length for a piston. The piston will try to reach the target length with the target velocity and the given amount of impulse/strength.

**Kind:** Function

**Environments:** Game

## Game

``` { .lua .api-signature }
joint:setTargetLength( targetLength, targetVelocity, maxImpulse? )
```

[Open the full Game reference](../Game-Script-Environment/Userdata/Joint.md#settargetlength)

**Availability:** Server only

The target length is measured in blocks.

This method cancels the effects of [setMotorVelocity](../Game-Script-Environment/Userdata/Joint.md#setmotorvelocity).

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `bearing` | [Joint](../Game-Script-Environment/Userdata/Joint.md) | The bearing. |
| `targetLength` | number | The target length. |
| `targetVelocity` | number | The target velocity. |
| `maxImpulse` *(optional)* | number | The max impulse. (Defaults to impulse used in game) |
