# engineSetModelOverlay (Client)

> Draws a material as an extra layer over the chosen materials of every instance of a model.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Materials and shaders
- **URL**: https://wiki.mymp.gg/en/engineSetModelOverlay

## Syntax

```lua
bool engineSetModelOverlay(string|element model, int|string selector, material material [, int priority = 0, int order = 0])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `model` | `string\|element` | The model's name or a `model` element. |
| `selector` | `int\|string` | Which material: its index from 1 or its name, as `engineGetModelMaterials` lists them. The name ignores case and takes the `*` and `?` wildcards. |
| `material` | `material` | The material drawn on top. |
| `priority` | `int` | Breaks ties between layers of the same order: the higher priority is drawn later. *(default: `0`)* |
| `order` | `int` | The order among the layers of the same material, lowest first. *(default: `0`)* |

## Returns

`true` when it was applied.

Every layer that picks a material is drawn, by order and then by priority.

## Example

```lua
local dirt = engineCreateMaterial("surface_alpha")
engineSetMaterialValue(dirt, "roughnessFactor", 1)
engineSetModelOverlay("bobcat", 1, dirt, 0, 1)
```

### Note

A name that is not a model is an error.

## See also

- [engineRestoreModelOverlay (Client)](https://wiki.mymp.gg/en/engineRestoreModelOverlay.md): Undoes what this resource's engineSetModelOverlay did of every instance of a model.
- [engineSetModelMaterial (Client)](https://wiki.mymp.gg/en/engineSetModelMaterial.md): Replaces the chosen materials of every instance of a model with a material.
- [engineSetWorldOverlay (Client)](https://wiki.mymp.gg/en/engineSetWorldOverlay.md): Draws a material as an extra layer over the chosen materials of every model in the world.
- [engineGetModelMaterials (Client)](https://wiki.mymp.gg/en/engineGetModelMaterials.md): Lists the loaded model's materials, in the order the model keeps them.
