> ## Documentation Index
> Fetch the complete documentation index at: https://docs.erlc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ERLC Game Event Triggers for Your Studio Automations

> Trigger automations from in-game ERLC events like player joins, kills, team changes, and emergency calls. Read event data with the Event Value block.

ERLC game event triggers let your automations react to everything happening inside your Liberty County server in real time. When a player joins, fires a command, gets killed, or has their team changed, Studio fires the matching trigger block and passes a structured event payload that you can read with the **Event Value** block. This page covers every game event trigger, its fields, and how to wire them together.

## Trigger Blocks

<CardGroup cols={2}>
  <Card title="erlc_when_event" icon="bolt">
    Fires whenever a selected in-game event occurs. Use the **EVENT\_TYPE** dropdown to choose which event — or pick `*` to catch all events in a single automation.
  </Card>

  <Card title="erlc_when_game_command" icon="terminal">
    Fires when a player types a custom in-game command (prefixed with `/`). Reads the command name and any space-separated arguments.
  </Card>
</CardGroup>

### `erlc_when_event` — EVENT\_TYPE Values

Use the **EVENT\_TYPE** dropdown to filter the events your automation responds to.

<Accordion title="All EVENT_TYPE options">
  | Value | When it fires |
  | - | - |
  | `*` | Every event — use when you want a single catch-all automation |
  | `player_killed` | A player is eliminated by another player or NPC |
  | `player_joined` | A player successfully enters the server |
  | `player_left` | A player disconnects or is removed |
  | `command_run` | Any in-game command is executed |
  | `moderation_call` | A moderator action is triggered |
  | `emergency_call_started` | A 911 call is initiated |
  | `emergency_call_resolved` | An active 911 call is closed |
  | `vehicle_spawned` | A vehicle is spawned by any player |
  | `vehicle_despawned` | A vehicle is removed from the server |
  | `player_queued` | A player enters the server queue |
  | `player_left_queue` | A player leaves the server queue without joining |
  | `player_team_changed` | A player switches to a different team/department |
  | `player_callsign_changed` | A player's callsign is updated |
  | `player_permission_changed` | A player's permission level is changed |
  | `player_wanted_level_changed` | A player's wanted stars are updated |
  | `custom_command` | A custom-defined in-game command is run |
  | `emergency_call` | Any emergency call event occurs |
</Accordion>

### `erlc_when_game_command`

This trigger is dedicated to custom in-game commands. Place the command name (without the `/`) in the **COMMAND** field. Studio fires this automation only when a player types that exact command, and makes the command arguments available via `erlc_event_value`.

***

## Reading Event Data

Once a game trigger fires, use **`erlc_event_value`** to extract fields from the event payload. Select a field from the **FIELD** dropdown to return its value as a string you can pass to other blocks.

<Accordion title="All FIELD options for erlc_event_value">
  | Field | Description |
  | - | - |
  | `EventType` | The string name of the event that fired (e.g. `player_joined`) |
  | `PlayerName` | Display name of the primary player involved |
  | `PlayerId` | Roblox user ID of the primary player |
  | `Player` | Full player object (use for nested lookups) |
  | `CommandName` | Name of the command that was run |
  | `CommandArguments` | Space-separated string of arguments passed to the command |
  | `Killer` | Full player object of the killer (kill events) |
  | `KillerName` | Display name of the killer |
  | `KillerId` | Roblox user ID of the killer |
  | `Killed` | Full player object of the victim |
  | `KilledName` | Display name of the victim |
  | `KilledId` | Roblox user ID of the victim |
  | `Timestamp` | ISO 8601 timestamp of when the event occurred |
  | `Command` | Raw command string that was executed |
  | `Caller` | Player who initiated the action |
  | `Moderator` | Moderator who performed the action (moderation events) |
  | `Join` | Boolean — `true` if the player joined rather than left |
  | `Team` | New team name after a `player_team_changed` event |
  | `Callsign` | New callsign value after a `player_callsign_changed` event |
  | `Permission` | New permission level after a `player_permission_changed` event |
  | `WantedStars` | Current wanted star count (0–5) |
  | `Previous` | Previous value before a change event |
  | `Current` | New value after a change event |
  | `CallNumber` | Unique identifier for an emergency call |
  | `Description` | Text description of the emergency call |
  | `PositionDescriptor` | Human-readable location of the emergency |
  | `Owner` | Player who owns the vehicle |
  | `Plate` | License plate of the vehicle |
  | `Name` | Vehicle model name |
  | `ColorName` | Color of the vehicle as a string |
</Accordion>

### `erlc_event_field` — Filter by Field Value

Use **`erlc_event_field`** as a conditional check inside your automation. It compares a chosen field against a value using one of three operators:

| Operator | Behaviour |
| - | - |
| `equals` | Exact match (case-sensitive) |
| `contains` | Substring match |
| `not_equals` | True when the field does **not** match |

<Tip>
  Combine `erlc_event_field` with an **If / Else** logic block to branch your automation — for example, only sending a welcome message when `Team` equals `Civilian`.
</Tip>

***

## Example Automation

The JSON below shows a complete automation that listens for `player_joined` and reads the joining player's name.

```json theme={null}
{
  "trigger": {
    "type": "erlc_when_event",
    "fields": {
      "EVENT_TYPE": "player_joined"
    }
  },
  "actions": [
    {
      "type": "erlc_event_value",
      "fields": {
        "FIELD": "PlayerName"
      },
      "output_variable": "joining_player"
    },
    {
      "type": "erlc_bot_send_message",
      "fields": {
        "CHANNEL_ID": "1234567890",
        "MESSAGE": "👋 {{joining_player}} just joined the server!"
      }
    }
  ]
}
```

<Note>
  The `erlc_event_value` block is only valid inside an automation that starts with a game event trigger. Placing it in a Discord-triggered automation will return an empty value.
</Note>

***

## Common Patterns

<Steps>
  <Step title="Choose your trigger event">
    Drag an **erlc\_when\_event** block onto the canvas and select the EVENT\_TYPE that matches what you want to respond to. Use `*` while prototyping so you can inspect all fields before narrowing down.
  </Step>

  <Step title="Extract the fields you need">
    Attach **erlc\_event\_value** blocks and pick the FIELD for each piece of data your logic requires — for example, `PlayerName` for a welcome message or `WantedStars` for a warrant alert.
  </Step>

  <Step title="Add conditional logic">
    Use **erlc\_event\_field** with `equals` or `contains` to gate your actions. Only proceed when the event matches your expected context.
  </Step>

  <Step title="Fire your action">
    Connect a Discord message block, an ERLC command block, or any other action. The event data flows through as variables into the action's fields.
  </Step>
</Steps>

<Warning>
  Selecting `*` as your EVENT\_TYPE in a high-traffic server can cause your automation to fire hundreds of times per minute. Add throttle or filter blocks downstream to avoid hitting rate limits.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.