# setWorldSoundEnabled (Client)

> Turns the game world's sounds (footsteps, gunfire, collisions and more) on or off by group or one by one.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Sound
- **URL**: https://wiki.mymp.gg/en/setWorldSoundEnabled

## Syntax

```lua
bool setWorldSoundEnabled(int group, bool enabled [, int index = -1, bool immediate = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `group` | `int` | The sounds' group (SA's bank slot). |
| `index` | `int` | One sound in the group, from 0 to 255. It can be left out for the whole group. *(default: `-1`)* |
| `enabled` | `bool` | `true` to let it play, `false` to silence it. |
| `immediate` | `bool` | When turning off, also stop the group's sounds that are already playing. *(default: `false`)* |

## Returns

Always `true`.

Use `showSound` to find the group and index of a sound as it plays.

## Example

```lua
setWorldSoundEnabled(5, false, true)
setWorldSoundEnabled(40, 3, false)
```

## See also

- [isWorldSoundEnabled (Client)](https://wiki.mymp.gg/en/isWorldSoundEnabled.md): Tells whether a world sound, or a group of them, is on.
- [resetWorldSounds (Client)](https://wiki.mymp.gg/en/resetWorldSounds.md): Turns back on every world sound turned off with setWorldSoundEnabled.
- [showSound (Client)](https://wiki.mymp.gg/en/showSound.md): Writes the group and index of every world sound that plays to the debug console. Works only in development mode.
- [onClientWorldSound (Client)](https://wiki.mymp.gg/en/onClientWorldSound.md): Fired when the game is about to play a world sound. Cancelling the event keeps the sound from playing.
