# engineSetModelTxd (Client)

> 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.

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

## Syntax

```lua
bool engineSetModelTxd(string|element model, txd|string txd [, 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. |
| `txd` | `txd\|string` | A `txd` element or a txd's name. |
| `priority` | `int` | Among several txds added to the same model, the highest priority is searched first; among equals, the newest. *(default: `0`)* |

## Returns

`true` once the txd is added. Raises an error if no model or no txd has that name.

The added txd is kept resident while the link lives.

## Example

```lua
local txd = engineLoadTxd("models/infernus_neon.ktd")
engineSetModelTxd("infernus", txd)
```

## See also

- [engineRestoreModelTxd (Client)](https://wiki.mymp.gg/en/engineRestoreModelTxd.md): Takes away the txds this resource put in front of a model with engineSetModelTxd.
- [engineGetModelTxds (Client)](https://wiki.mymp.gg/en/engineGetModelTxds.md): Lists the txds a model takes its textures from, in the order it searches them.
- [engineLoadTxd (Client)](https://wiki.mymp.gg/en/engineLoadTxd.md): Loads a texture dictionary (.ktd) from a resource file under a name. It exists on this client only.
- [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.
