> For the complete documentation index, see [llms.txt](https://scripting.breeze.rip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://scripting.breeze.rip/api/functions/math.clamp.md).

# math.clamp

> **clamp**(`value`, `min`, `max`): `number`

Clamps a value so it never leaves the given range.

### Parameters

#### value

`number`

The value to clamp.

#### min

`number`

The lowest value the result can be.

#### max

`number`

The highest value the result can be.

### Returns

`number`

The value, limited to the range between min and max.

### Example

```ts
math.clamp(health, 0, 20);
```
