# removePlayerFromVoiceChannel (Server)

> Takes a player out of a voice channel.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Server
- **Category**: Voice
- **URL**: https://wiki.mymp.gg/en/removePlayerFromVoiceChannel

## Syntax

```lua
bool removePlayerFromVoiceChannel(element channel, player player)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `channel` | `element` | The channel, from `createVoiceChannel`. |
| `player` | `player` | The player. |

## Returns

`true` if they were taken out, `false` if the player was not in the channel.

A channel created in mode `3` is destroyed when the last player leaves. A player who leaves the server leaves every channel.

## Example

```lua
local team = createVoiceChannel(0, 0)

addCommandHandler("leaveteam", function(player)
    removePlayerFromVoiceChannel(team, player)
end)
```

## See also

- [addPlayerToVoiceChannel (Server)](https://wiki.mymp.gg/en/addPlayerToVoiceChannel.md): Puts a player in a voice channel. From then on they hear and are heard by the others in the channel.
- [deleteVoiceChannel (Server)](https://wiki.mymp.gg/en/deleteVoiceChannel.md): Destroys a voice channel. The players who were in it stop hearing each other through it.
