# engineSetModelTexture (Client)

> Swaps a texture on every instance of a model. Only that model's materials change, not the txd the texture comes from.

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

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `model` | `string\|element` | The model's name, or a `model` element from `engineCreateModel`. It need not be loaded yet. |
| `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 no model has that name or the source is not an image or `false`.

A model's swaps answer under an element's (`engineSetElementTexture`) and over the world's (`engineSetWorldTexture`).

## Example

```lua
local lights = engineCreateTexture("images/lights.png")
engineSetModelTexture("infernus", "vehiclelights128", lights)
```

## See also

- [engineRestoreModelTexture (Client)](https://wiki.mymp.gg/en/engineRestoreModelTexture.md): Removes the texture swaps this resource set on a model with engineSetModelTexture.
- [engineSetElementTexture (Client)](https://wiki.mymp.gg/en/engineSetElementTexture.md): Swaps a texture on one vehicle, ped, player or object alone. Other instances of the same model keep their textures.
- [engineSetWorldTexture (Client)](https://wiki.mymp.gg/en/engineSetWorldTexture.md): Swaps a texture on every model of the chosen kinds that uses it. Only the models' materials change, not the txd the texture comes from.
- [engineSetModelTxd (Client)](https://wiki.mymp.gg/en/engineSetModelTxd.md): Puts a txd in front of a model's own, so the model finds its textures there first and falls back to its own for the rest.
