# setPedOverlay (Shared)

> Puts an overlay on a ped's face or takes it off, such as a beard, eyebrows or make-up.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Appearance
- **URL**: https://wiki.mymp.gg/en/setPedOverlay

## Syntax

```lua
bool setPedOverlay(ped ped, string name [, int|bool variation = 0, float opacity = 1])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player. |
| `name` | `string` | The overlay's name, as the ped's head declares it. Case does not matter. |
| `variation` | `int\|bool` | The overlay's variant, from 0 to 255, or `false` to remove it. *(default: `0`)* |
| `opacity` | `float` | Opacity, from 0 to 1. Not used with `false`. *(default: `1`)* |

## Returns

`true` if it changed, `false` when asked to remove an overlay the ped does not wear. Raises an error if the name is over 32 characters, the variant is outside 0 to 255 or the opacity is outside 0 to 1.

On the server, the change is sent to every client. On the client, it applies to this client only.

## Example

```lua
addCommandHandler("barba", function(player, command, variation)
    if variation then
        setPedOverlay(player, "beard", tonumber(variation), 0.9)
    else
        setPedOverlay(player, "beard", false)
    end
end)
```

### Coming from MTA

MTA does not have this function. It follows FiveM's `SetPedHeadOverlay`.

### Note

A ped wears up to 64 overlays. Past that, a new one raises the same bad argument error.

## See also

- [getPedOverlay (Shared)](https://wiki.mymp.gg/en/getPedOverlay.md): Tells which variant of an overlay a ped wears on its face.
- [setPedOverlayColor (Shared)](https://wiki.mymp.gg/en/setPedOverlayColor.md): Tints an overlay the ped wears on its face, by a palette row or by a colour.
- [setPedHeadBlend (Shared)](https://wiki.mymp.gg/en/setPedHeadBlend.md): Builds a ped's face by blending the head and skin of two parents.
