# engineSetTxdTexture (Client)

> Puts an image in a txd under a texture name, replacing the texture of that name or adding a new one. Everything that reads the txd follows: models, peds, landscapes, roads, particles, water and sky.

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

## Syntax

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

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `txd` | `txd\|string` | A `txd` element, a txd's name, or a glob pattern matching several txds. |
| `name` | `string` | The texture's name, or a glob pattern. |
| `source` | `texture\|dui\|bool` | A `texture` (a file texture, render target, screen source or txd texture), a `dui`, or `false` to hide the texture. |
| `priority` | `int` | Among several links for the same texture, the highest priority answers; among equals, the newest. *(default: `0`)* |

## Returns

`true` once the link is made. Raises an error if the txd does not exist or the source is not an image or `false`.

A link to a txd texture follows that txd's own links, 8 deep at most. The resource's links go when it stops or when `engineRestoreTxdTexture` removes them.

## Example

```lua
local plate = engineCreateTexture("images/plate.png")
engineSetTxdTexture("infernus", "vehiclelights128", plate)
engineSetTxdTexture("*", "graffiti*", false)
```

## See also

- [engineRestoreTxdTexture (Client)](https://wiki.mymp.gg/en/engineRestoreTxdTexture.md): Removes the links this resource made in a txd with engineSetTxdTexture, so it gives its own textures again.
- [engineGetTxdTexture (Client)](https://wiki.mymp.gg/en/engineGetTxdTexture.md): Gives a texture element that shows what a txd shows under a texture name, to draw it or use it as a source.
- [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.
- [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.
