# onClientTrailerDetach (Client)

> Fired on the client when a trailer is unhitched from the vehicle towing it.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Client
- **Category**: Vehicles
- **URL**: https://wiki.mymp.gg/en/onClientTrailerDetach

## Syntax

```lua
addEventHandler("onClientTrailerDetach", root, function(vehicle towedBy) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `towedBy` | `vehicle` | The vehicle that was towing the trailer. |

## Source

The trailer.

## Example

```lua
addEventHandler("onClientTrailerDetach", root, function(towedBy)
    if getPedOccupiedVehicle(localPlayer) == towedBy then
        outputDebugString("Trailer unhitched")
    end
end)
```

## See also

- [onClientTrailerAttach (Client)](https://wiki.mymp.gg/en/onClientTrailerAttach.md): Fired on the client when a trailer is hitched to a vehicle.
- [onTrailerDetach (Server)](https://wiki.mymp.gg/en/onTrailerDetach.md): Fired on the server when a trailer is unhitched from the vehicle towing it.
- [getVehicleTowedByVehicle (Shared)](https://wiki.mymp.gg/en/getVehicleTowedByVehicle.md): Returns the trailer or vehicle this vehicle is towing.
- [getVehicleTowingVehicle (Shared)](https://wiki.mymp.gg/en/getVehicleTowingVehicle.md): Returns the vehicle that is towing this vehicle.
