# engineSetElementOverlay (Client)

> Draws a material as an extra layer over the chosen materials of a single vehicle, ped or object.

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

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | A vehicle, ped, player or object. |
| `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 highlight = engineCreateMaterial("surface_emissive")
engineSetMaterialValue(highlight, "glowTint", tocolor(80, 160, 255))

local crate = createObject("trafficcone", 2490.0, -1670.0, 13.3)
engineSetElementOverlay(crate, "*", highlight)
```

### Note

An element that is not a vehicle, ped, player or object is an error.

## See also

- [engineRestoreElementOverlay (Client)](https://wiki.mymp.gg/en/engineRestoreElementOverlay.md): Undoes what this resource's engineSetElementOverlay did of a single vehicle, ped or object.
- [engineSetElementMaterial (Client)](https://wiki.mymp.gg/en/engineSetElementMaterial.md): Replaces the chosen materials of a single vehicle, ped or object with a material.
- [engineSetElementStencil (Client)](https://wiki.mymp.gg/en/engineSetElementStencil.md): Marks a vehicle, ped or object with a stencil value, which post shaders read for outlines, highlights and similar effects.
- [engineCreateMaterial (Client)](https://wiki.mymp.gg/en/engineCreateMaterial.md): Creates a material: a shader with parameter values, which then replaces or overlays the materials of models.
