# engineLoadTxd (Client)

> Loads a texture dictionary (`.ktd`) from a resource file under a name. It exists on this client only.

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

## Syntax

```lua
txd engineLoadTxd(string path [, string name = the file's name without its extension])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `path` | `string` | Path to the `.ktd` file in the resource. |
| `name` | `string` | The dictionary's name. *(default: `the file's name without its extension`)* |

## Returns

The new `txd` element. Raises an error if another script's txd has that name or the file cannot be found.

If a pack already has a txd with that name, the loaded one covers it while it lives, and a warning is logged.

## Example

```lua
local txd = engineLoadTxd("models/u6car.ktd")

addEventHandler("onClientAssetLoad", txd, function(loaded)
    if loaded then
        engineSetModelTxd("infernus", txd)
    end
end)
```

### Note

The file is read in the background, so the txd is empty until `onClientAssetLoad` fires on it. If the file cannot be read, the event gets `false`.

## See also

- [engineCreateTxd (Client)](https://wiki.mymp.gg/en/engineCreateTxd.md): Creates an empty texture dictionary under a name. Fill it with engineSetTxdTexture. It exists on this client only.
- [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.
- [engineGetTxdTextures (Client)](https://wiki.mymp.gg/en/engineGetTxdTextures.md): Lists the names of the textures a txd gives, links included.
- [onClientAssetLoad (Client)](https://wiki.mymp.gg/en/onClientAssetLoad.md): Fired once when an asset a script started loading in the background is ready, or has failed.
