> For the complete documentation index, see [llms.txt](https://docs.moxha.dev/documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.moxha.dev/documentation/paid-scripts/surround-spatial-audio/api/server/set.md).

# Set

These are setters

### Set TimeStamp

```lua
exports['mx-surround']:setTimeStamp(source, soundId, timeStamp)
```

**Parameters**

* > **source:** `number`
* > **soundId**: `string`
* > **timeStamp:** `number`

***

### Set Volume

```lua
exports['mx-surround']:setVolumeMax(source, soundId, volume, disableOverWrite)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **volume:** `number`
* > **disableOverWrite?:** `boolean`
  >
  > * If true, volume will not be overwritten by sound profile

***

### Set Type

```lua
exports['mx-surround']:setStereoMode(source, soundId, stereo)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **stereo:** `boolean`
  >
  > * If this is false, it will be spatial (3D)

***

### Set Panner

```lua
exports['mx-surround']:setPanner(source, soundId, panner)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **panner:** `PannerNode`
  >
  > * [See](https://developer.mozilla.org/en-US/docs/Web/API/PannerNode?retiredLocale=tr)

***

### Set Coords

```lua
exports['mx-surround']:setCoords(source, soundId, coords, xSound)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **coords:** `vector3`
* > **xSound?:** `boolean`

***

### Set TimeStamp

```lua
exports['mx-surround']:setTimeStamp(source, soundId, timeStamp)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **coords:** `number`

***

### Set Loop

```lua
exports['mx-surround']:setSoundLoop(source, soundId, loop)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **loop:** `boolean`

***

### Set Max Distance

```lua
exports['mx-surround']:setMaxDistance(source, soundId, maxDistance)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **maxDistance:** `number`

***

### Set Destroy On Finish

```lua
exports['mx-surround']:setDestroyOnFinish(source, soundId, destroyOnFinish)
```

#### Parameters

* > **source:** `number`
* > **soundId:** `string`
* > **destroyOnFinish:** `number`

{% hint style="info" %}
These four mirror the client exports of the same name, with `source` in front. Pass `-1` to apply to everyone and keep it on the server record.
{% endhint %}

***

### Set Emitters

```lua
exports['mx-surround']:setEmitters(source, soundId, emitters)
```

#### Parameters

* **source**: `number` — `-1` for everyone
* **soundId**: `string | number`
* **emitters**: `vector3[]` — up to 8 positions

#### Returns

* `true | false`

***

### Set Fills Space

```lua
exports['mx-surround']:setFillsSpace(source, soundId, options)
```

#### Parameters

* **source**: `number` — `-1` for everyone
* **soundId**: `string | number`
* **options**: `table | false` — same shape as the client export

#### Returns

* `true | false`

***

### Set Leak Distance

```lua
exports['mx-surround']:setLeakDistance(source, soundId, options)
```

#### Parameters

* **source**: `number` — `-1` for everyone
* **soundId**: `string | number`
* **options**: `table | false` — `{ min, max, maxLeakage }`

#### Returns

* `true | false`

***

### Set Rolloff

```lua
exports['mx-surround']:setRolloff(source, soundId, scale, plateau)
```

#### Parameters

* **source**: `number` — `-1` for everyone
* **soundId**: `string | number`
* **scale**: `number`
* **plateau?**: `number`

#### Returns

* `true | false`

***

#### Set Playback Rate

```lua
local applied = exports['mx-surround']:setPlaybackRate(source, soundId, rate, preservePitch)
```

Play a sound faster or slower for one player, or for everyone with `-1`.

With `-1` the rate is saved on the server: players who join or walk into range later start at the same speed. The server's own clock also runs at that rate, so `getTimeStamp`, the join seek and the end-of-track timing all stay in media time. This works for sounds placed with the creator too, and the rate carries over to the next track in the playlist.

**Parameters**

* **source**: `number`
  * `-1` for everyone
* **soundId**: `string | number`
* **rate**: `number`
  * `1.0` is normal speed. Clamped to `0.25` - `4.0`
  * YouTube links snap to YouTube's own speeds: `0.25`, `0.5`, `0.75`, `1.0`, `1.25`, `1.5`, `1.75`, `2.0`
* **preservePitch?**: `boolean`
  * `true` keeps the key, `false` lets the pitch follow the speed. Default `true`

**Returns**

* `number | false`
  * The rate actually applied

***
