# setVehicleDirtColor (Shared)

> Changes the colour of the dirt on a vehicle's paint, such as mud or sand.

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

## Syntax

```lua
bool setVehicleDirtColor(element element, color color)
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `element` | `element` | A vehicle, or a parent element: every vehicle below it changes too. |
| `color` | `color` | Three numbers `r, g, b` (integers from 0 to 255) or a `tocolor` value. Alpha is ignored. |

## Returns

`true` if it changed, `false` if it is not a vehicle.

On the server, the change is sent to every client. On the client, it applies to this client only.

## Example

```lua
local vehicle = createVehicle("infernus", -2400, -600, 132)
setVehicleDirtColor(vehicle, 110, 80, 50)
setVehicleDirtLevel(vehicle, 0.8)
```

### Note

With a parent element (such as `root`), every vehicle below changes, but the return value is the element's own, which is not a vehicle: `false`.

## See also

- [getVehicleDirtColor (Shared)](https://wiki.mymp.gg/en/getVehicleDirtColor.md): Tells the colour of the dirt on a vehicle's paint.
- [resetVehicleDirtColor (Shared)](https://wiki.mymp.gg/en/resetVehicleDirtColor.md): Puts a vehicle's dirt back to the default colour, 59, 57, 52.
- [setVehicleDirtLevel (Shared)](https://wiki.mymp.gg/en/setVehicleDirtLevel.md): Changes how much dirt shows on a vehicle's paint.
