> ## 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.

# Player Data, Teams, and Collections in erlc.dev Studio

> Query in-game player data including names, teams, locations, and permissions. Iterate over players and access server collections like logs.

erlc.dev Studio exposes a rich set of value blocks for reading live player data from your ERLC server. You can look up individual players by name or ID, inspect their team and location, compare counts, and iterate over server-wide collections like join logs, kill logs, and mod calls — all from the drag-and-drop editor.

## Finding Players

Use these value blocks to retrieve player objects or numeric counts from your server. Connect them to other blocks as inputs wherever a player or number is expected.

<CardGroup cols={2}>
  <Card title="erlc_find_player" icon="magnifying-glass">
    Look up a specific player. Connect a value block to the **QUERY** input and set the **BY** field to either `name` or `id`.
  </Card>

  <Card title="erlc_random_player" icon="shuffle">
    Returns a random currently online player. No inputs required.
  </Card>

  <Card title="erlc_player_count_value" icon="users">
    Returns the current player count as a number. No inputs required. Use this wherever you need the raw count.
  </Card>

  <Card title="erlc_player_count" icon="greater-than-equal">
    Returns a boolean by comparing the player count against a value. Connect **VALUE** and set the **OPERATOR** field (`>`, `>=`, `=`, `!=`, `<`, `<=`).
  </Card>

  <Card title="erlc_staff_count" icon="shield">
    Returns the number of staff members currently in the server. No inputs required.
  </Card>

  <Card title="erlc_queue_count" icon="clock">
    Returns the number of players currently in the server queue. No inputs required.
  </Card>

  <Card title="erlc_vehicle_count" icon="car">
    Returns the number of active vehicles in the server. No inputs required.
  </Card>

  <Card title="erlc_team_count" icon="people-group">
    Returns the number of players on a specific team. Connect a value block to the **TEAM** input.
  </Card>
</CardGroup>

***

## Player Properties

Once you have a player object, use `erlc_player_property` or the dedicated property blocks to read individual attributes.

### erlc\_player\_property

Connect a player value block to the **PLAYER** input and choose a **FIELD** from the dropdown:

| Field | Description |
| - | - |
| `PlayerName` | The player's Roblox username |
| `PlayerId` | The player's Roblox user ID |
| `Team` | The team the player is currently on |
| `Callsign` | The player's active callsign |
| `Permission` | The player's permission level |
| `WantedStars` | Number of wanted stars the player has |
| `Location.PostalCode` | Postal code of the player's current location |
| `Location.StreetName` | Street name at the player's location |
| `Location.BuildingNumber` | Building number at the player's location |
| `Location.LocationX` | X coordinate of the player |
| `Location.LocationZ` | Z coordinate of the player |

### Dedicated Property Blocks

For common checks, Studio provides focused blocks that are easier to wire up:

<CardGroup cols={2}>
  <Card title="erlc_player_callsign" icon="radio">
    Returns the player's callsign string. Input: **PLAYER**.
  </Card>

  <Card title="erlc_player_location" icon="location-dot">
    Returns the player's full location object. Input: **PLAYER**.
  </Card>

  <Card title="erlc_player_online" icon="circle-dot">
    Returns a boolean — `true` if the player is currently online. Input: **PLAYER**.
  </Card>

  <Card title="erlc_player_wanted" icon="star">
    Returns the player's current wanted level. Input: **PLAYER**.
  </Card>

  <Card title="erlc_player_is_moderator_or_admin" icon="shield-check">
    Returns `true` if the player is a moderator or admin. Input: **PLAYER**.
  </Card>

  <Card title="erlc_player_team_is" icon="people-group">
    Returns `true` if the player is on the specified team. Inputs: **PLAYER**, **TEAM**.
  </Card>

  <Card title="erlc_player_permission_is" icon="lock">
    Returns `true` if the player holds the given permission level. Inputs: **PLAYER**, **PERMISSION**.
  </Card>

  <Card title="erlc_player_distance" icon="ruler">
    Returns the distance in studs between two players. Inputs: **A**, **B**.
  </Card>
</CardGroup>

***

## Team Filtering

Use `erlc_players_on_team` to get a list of all players currently on a given team. Connect a value block to the **TEAM** input. The block returns a list of player objects you can iterate over with a loop block.

***

## Server Collections

Collections let you query server-wide data sets — from currently online players to historical logs. Use these value blocks to retrieve full lists, counts, or individual records.

### erlc\_server\_collection

Returns a full list for the selected collection. Set the **COLLECTION** field dropdown to one of:

`Players` · `Staff` · `Queue` · `JoinLogs` · `KillLogs` · `CommandLogs` · `ModCalls` · `Vehicles` · `EmergencyCalls`

### erlc\_collection\_count

Returns the count of records in a collection. Available collections:

`Players` · `Queue` · `Vehicles` · `JoinLogs` · `KillLogs` · `CommandLogs` · `ModCalls` · `EmergencyCalls`

### erlc\_latest\_record

Returns the most recent record in a log collection. Available collections:

`JoinLogs` · `KillLogs` · `CommandLogs` · `ModCalls` · `EmergencyCalls`

### erlc\_record\_property

Read a field from a record object. Connect any record value block to the **RECORD** input, then choose a **FIELD**:

<Accordion title="Available record fields">
  | Field | Relevant collections |
  | - | - |
  | `PlayerName` | JoinLogs, KillLogs, CommandLogs |
  | `PlayerId` | JoinLogs, KillLogs, CommandLogs |
  | `Join` | JoinLogs |
  | `Timestamp` | JoinLogs, KillLogs, CommandLogs, ModCalls, EmergencyCalls |
  | `Killed` | KillLogs |
  | `Killer` | KillLogs |
  | `Command` | CommandLogs |
  | `Caller` | CommandLogs |
  | `Moderator` | ModCalls |
  | `Team` | ModCalls, Vehicles |
  | `Permission` | CommandLogs |
  | `Name` | Vehicles |
  | `Owner` | Vehicles |
  | `Plate` | Vehicles |
  | `Texture` | Vehicles |
  | `ColorHex` | Vehicles |
  | `ColorName` | Vehicles |
  | `Location.*` | Vehicles |
  | `CallNumber` | EmergencyCalls |
  | `Description` | EmergencyCalls |
  | `Position` | EmergencyCalls |
  | `PositionDescriptor` | EmergencyCalls |
  | `StartedAt` | EmergencyCalls |
</Accordion>

***

## Example: Iterate Over Players and Check Team

The following automation retrieves all players currently on the `Police` team and logs each player's name to the Studio panel.

```json theme={null}
{
  "type": "erlc_for_each",
  "id": "loop_1",
  "fields": {
    "VARIABLE": "player"
  },
  "inputs": {
    "LIST": {
      "block": {
        "type": "erlc_players_on_team",
        "id": "team_list_1",
        "inputs": {
          "TEAM": {
            "block": {
              "type": "text",
              "id": "team_text_1",
              "fields": {
                "TEXT": "Police"
              }
            }
          }
        }
      }
    },
    "DO": {
      "block": {
        "type": "erlc_log",
        "id": "log_1",
        "inputs": {
          "MESSAGE": {
            "block": {
              "type": "erlc_player_property",
              "id": "prop_1",
              "inputs": {
                "PLAYER": {
                  "block": {
                    "type": "erlc_variable_value",
                    "id": "var_1",
                    "fields": {
                      "VARIABLE": "player"
                    }
                  }
                }
              },
              "fields": {
                "FIELD": "PlayerName"
              }
            }
          }
        }
      }
    }
  }
}
```

<Steps>
  <Step title="Get the team list">
    `erlc_players_on_team` fetches every player currently on the `Police` team and returns them as a list.
  </Step>

  <Step title="Loop over the list">
    The `erlc_for_each` block iterates over each player object in the list, storing the current item in the `player` variable.
  </Step>

  <Step title="Read and log the name">
    Inside the loop, `erlc_player_property` reads the `PlayerName` field from the current player, and `erlc_log` prints it to the Studio panel.
  </Step>
</Steps>

<Tip>
  Swap the `erlc_log` block for an `erlc_command` block to take automated in-game action on each matched player — for example, sending them a message or updating their callsign.
</Tip>


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