> For the complete documentation index, see [llms.txt](https://docs.0resmon.org/0resmon/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.0resmon.org/0resmon/0resmon-1/wais-resoucres/wais-speaker-boombox/exports/server.md).

# Server

## AttachSongToEntity

Allows you to attach songs to entities.

```lua
exports["wais-speaker"]:AttachSongToEntity(netId, url, volume, loop, rate, maxDistance)
```

* netId: `number`
  * The NetworkId belonging to the entity to which the song will be attached.
* url: `string`
  * This is the URL of the song to be used from YouTube. The song must be longer than 05:00 minutes. Example: [<sub>https://www.youtube.com/watch?v=nmnjL26OBcY</sub>](https://www.youtube.com/watch?v=nmnjL26OBcY)
* volume?: `float`
  * The volume level of the song.
  * Min: `0.0`
  * Max: `1.0`
  * Default: `0.50`
* loop?: `boolean`
  * Should the song be played again and again?
  * Default: `false`
* rate?: `float`
  * The playback speed of the song.
  * Default: `1.0`
* maxDistance?: `float`
  * The distance value at which users will interact to hear the song.
  * Default: `Config.InteractionDistances.speakers (10.0)`

Return:

* success: `boolean`
* message: `string`
* data: `table`
  * videoId: `string`
  * title: `string`
  * author: `string`
  * duration: `number (max duration of video)`
  * thumbnail: `url`

***

## DestroySpeaker

It allows you to completely delete the song

```lua
exports["wais-speaker"]:DestroySpeaker(netId)
```

* netId: `number`
  * NetworkId belonging to the entity to which the song will be deleted

Return:

* success: `boolean`
* message: `string`

***

## GetSpeaker

It allows you to access the speaker and its methods.

```lua
local speaker = exports["wais-speaker"]:GetSpeaker(netId)
```

* netId: `number`
  * The NetworkId of the speaker you want to access.

Return:

* `destroy()`
  * Deletes the song completely.
* `pause()`
  * It stops the song.
* `resume()`
  * Continues the song.
* `setVolume(volume)`
  * Adjusts the volume of the song.
  * volume: `number`
* `setDistance(distance)`
  * It changes the distance the song can be heard.
  * distance: `float`
* `seek(duration)`
  * You can skip to any second in the song.
  * duration: `float`

***

## InstallCarplay

If the option to use CarPlay by installing it is active, it will allow you to install CarPlay in your vehicle.

```lua
exports["wais-speaker"]:InstallCarplay(plate, netId)
```

* plate: `string`
  * The license plate of the vehicle where CarPlay will be installed.
* netId: `number`
  * The NetworkId of the vehicle where Carplay will be installed.

Return:

* success: `boolean`
* message: `string`
  * *invalid\_arguments, carplay\_installed*

***

## RemoveCarplay

If the option to use CarPlay as an item is enabled, it will remove CarPlay from the vehicle.

```lua
exports["wais-speaker"]:RemoveCarplay(plate, netId)
```

* plate: `string`
  * The license plate of the vehicle where CarPlay will be removed.
* netId: `number`
  * The NetworkId of the vehicle where Carplay will be removed.

Return:

* success: `boolean`
* message: `string`
  * *invalid\_arguments, failed\_to\_remove\_carplay, carplay\_removed*


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.0resmon.org/0resmon/0resmon-1/wais-resoucres/wais-speaker-boombox/exports/server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
