> For the complete documentation index, see [llms.txt](https://5scripts-1.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://5scripts-1.gitbook.io/docs/assets/5s_lib/custom-sounds.md).

# Custom sounds

You can find sound installation instructions in the [Sound Installation](/docs/installation/sounds.md) section.

To run custom sound, you need add to your resource `fxmanifest.lua` file:

```lua
    shared_scripts {
        '@5s_lib/init.lua'
    }
```

## Client exports

### Play local sound for client

```lua
    fs.utils.PlayLocalSound(soundDict, soundName, ?soundBank)

    --example

    fs.utils.PlayLocalSound('5s_testsounds', 'test_sound')
```

### Play sound from entity

```lua
    fs.utils.PlaySoundFromEntity(soundDict, soundName, entity, networked, ?soundBank)

    --example

    fs.utils.PlaySoundFromEntity('5s_testsounds', 'test_sound', PlayerPedId(), false)
```

### Play sound from coordinates

```lua
    fs.utils.PlaySoundFromCoord(soundDict, soundName, coords, networked, ?soundBank)

    --example

    fs.utils.PlaySoundFromCoord('5s_testsounds', 'test_sound', vector3(0, 0, 0), false)
```

## Server exports

Server-side sound functions trigger the sound on the specified client. They do not accept a `soundBank` parameter - the client handler derives it automatically.

### Play local sound for client

```lua
    fs.utils.PlayLocalSound(source, soundDict, soundName)

    --example

    fs.utils.PlayLocalSound(source, '5s_testsounds', 'test_sound')
```

### Play sound from entity

```lua
    fs.utils.PlaySoundFromEntity(source, soundDict, soundName, entity, networked)

    --example

    fs.utils.PlaySoundFromEntity(source, '5s_testsounds', 'test_sound', entity, false)
```

### Play sound from coordinates

```lua
    fs.utils.PlaySoundFromCoord(source, soundDict, soundName, coords, networked)

    --example

    fs.utils.PlaySoundFromCoord(source, '5s_testsounds', 'test_sound', vector3(0, 0, 0), false)
```
