> For the complete documentation index, see [llms.txt](https://documentation.jaksam-scripts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.jaksam-scripts.com/missions-creator/server/on-mission-failed.md).

# On mission failed

Event triggered on mission fail

## Event

Add this event in any server file you want to use it in

```lua
RegisterNetEvent("missions_creator:missionFailed", function(instanceId, missionId, players, reason)

end)
```

### Parameters

| Name         | Data Type | Description                                          |
| ------------ | --------- | ---------------------------------------------------- |
| `instanceId` | integer   | Unique session ID                                    |
| `missionId`  | integer   | Mission ID, the one you see in admin menu            |
| `players`    | table     | Table containing players who partecipate the mission |
| `reason`     | string    | The reason the mission has failed                    |
