# onClientResourceStop (Client)

> Fired when a resource is about to stop, while its scripts and elements still exist.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Event
- **Side**: Client
- **Category**: Resources and modules
- **URL**: https://wiki.mymp.gg/en/onClientResourceStop

## Syntax

```lua
addEventHandler("onClientResourceStop", root, function(resource stoppedResource) ... end)
```

## Handler parameters

| Name | Type | Description |
| --- | --- | --- |
| `stoppedResource` | `resource` | The resource about to stop. |

## Source

The element of the resource about to stop.

With a handler on `resourceRoot`, only the resource itself; with one on `root`, every resource.

## Example

```lua
addEventHandler("onClientResourceStop", resourceRoot, function(stoppedResource)
    outputDebugString(getResourceName(stoppedResource) .. " is stopping")
end)
```

## See also

- [onClientResourceStart (Client)](https://wiki.mymp.gg/en/onClientResourceStart.md): Fired when a resource has finished starting, after its scripts have run.
- [getResourceName (Shared)](https://wiki.mymp.gg/en/getResourceName.md): Returns a resource's name.
- [getThisResource (Shared)](https://wiki.mymp.gg/en/getThisResource.md): Returns the resource the script is running in.
