# engineSetElementTexture (Client)

> Swaps a texture on one vehicle, ped, player or object alone. Other instances of the same model keep their textures.

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

## Syntax

```lua
bool engineSetElementTexture(element element, string name, texture|dui|bool source [, int priority = 0])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | The vehicle, ped, player or object. |
| `name` | `string` | The texture name its materials use, or a glob pattern. |
| `source` | `texture\|dui\|bool` | A `texture`, a `dui`, or `false` to hide the texture. |
| `priority` | `int` | Among several swaps for the same texture, the highest priority answers; among equals, the newest. *(default: `0`)* |

## Returns

`true` once the swap is set. Raises an error if the element is not a vehicle, ped, player or object, or the source is not an image or `false`.

The swap is kept while the element lives, whether it is streamed in or out. An element's swaps answer before the model's (`engineSetModelTexture`) and the world's (`engineSetWorldTexture`).

## Example

```lua
local vehicle = createVehicle("infernus", 1544.0, -1675.0, 13.6)
local lights = engineCreateTexture("images/lights.png")
engineSetElementTexture(vehicle, "vehiclelights128", lights)
```

## See also

- [engineRestoreElementTexture (Client)](https://wiki.mymp.gg/en/engineRestoreElementTexture.md): Removes the texture swaps this resource set on one element with engineSetElementTexture.
- [engineSetModelTexture (Client)](https://wiki.mymp.gg/en/engineSetModelTexture.md): Swaps a texture on every instance of a model. Only that model's materials change, not the txd the texture comes from.
- [engineSetElementMaterial (Client)](https://wiki.mymp.gg/en/engineSetElementMaterial.md): Replaces the chosen materials of a single vehicle, ped or object with a material.
