# getClothesVariantCount (Shared)

> Counts how many textures a piece of clothing has for a ped's model.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Appearance
- **URL**: https://wiki.mymp.gg/en/getClothesVariantCount

## Syntax

```lua
int|false getClothesVariantCount(ped ped, string model)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `ped` | `ped` | The ped or player whose model wears the piece. |
| `model` | `string` | The piece of clothing's model. |

## Returns

The number of variants, which `addPedClothes` takes from 0 to that number minus 1, or `false` if the ped's model has no such piece.

## Example

```lua
addCommandHandler("cor", function(player, command, model)
    local count = getClothesVariantCount(player, model)
    if count then
        addPedClothes(player, model, math.random(0, count - 1))
    end
end)
```

## See also

- [addPedClothes (Shared)](https://wiki.mymp.gg/en/addPedClothes.md): Dresses a ped in a piece of clothing. The piece takes its slot and replaces whatever was in it.
- [getPedClothes (Shared)](https://wiki.mymp.gg/en/getPedClothes.md): Tells which clothes a ped wears, all of them or the one in a slot.
