> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-es/runtime-de-la-escena/modulos-de-runtime/players.md).

# Players

El `Players` módulo permite [escenas](https://github.com/decentraland/docs/blob/main/contributor/content/entity-types/scenes/README.md) para buscar players en su entorno y obtener información sobre su identidad y [profiles](https://github.com/decentraland/docs/blob/main/contributor/content/entity-types/profiles/README.md).

```ts
const Players = require("~system/Players");
```

Contiene los siguientes métodos y tipos:

* [`function getPlayersInScene`](#getPlayersInScene)
* [`function getConnectedPlayers`](#getPlayersInScene)
* [`function getPlayerData`](#getPlayerData)
* [`interface Player`](#Player)
* [`interfaz UserData`](#UserData)

### Métodos

Hay dos métodos en este módulo para descubrir players en la escena, y uno para obtener sus profiles.

**`getPlayersInScene`**

Returns a [`Player`](#Player) array, each with a `userId` that can be used in [getPlayerData](#getPlayerData).

```ts
interface Request {}

interface Response {
  players: Player[];
}

function getPlayersInScene(Request): Promise<Response>;
```

**`getConnectedPlayers`**

```ts
interface Request {}

interface Response {
  players: Player[];
}

function getConnectedPlayers(Request): Promise<Response>;
```

**`getPlayerData`**

Devuelve la [`UserData`](#UserData) para un usuario, si se conoce para el dado `userId`.

```ts
interface Request {
  // The user identifier, (for non-guests, their Ethereum address).
  userId: string;
}

interface Response {
  // The profile information for this user, if available.
  data?: UserData;
}

function getPlayerData(Request): Promise<Response>;
```

### Tipos

Solo hay dos tipos en este módulo: [`Player`](#Player) y [`UserData`](#UserData).

**`Player`**

Mantiene una referencia a un `userId`.

```ts
interface Player {
  // The user identifier, (for non-guests, their Ethereum address).
  userId: string;
}
```

**`UserData`**

Contiene información (posiblemente parcial) sobre un usuario, su identidad y avatar.

World Explorers obtienen esta información a través del [content system](https://github.com/decentraland/docs/blob/main/contributor/content/overview/README.md).

El [profile entity definition](https://github.com/decentraland/docs/blob/main/contributor/content/entity-types/profiles/README.md) detalla todos estos campos y más. Aunque la estructura y las claves de `UserData` son ligeramente diferentes, el significado de cada campo es el mismo.

```ts
export interface UserData {
  // The user identifier (i.e. their Ethereum address).
  userId: string;

  // Un nombre para llamarlo en la IU.
  displayName: string;

  // La clave pública de Ethereum con la que firma.
  publicKey?: string;

  // Si tienen la funcionalidad web3 habilitada.
  hasConnectedWeb3: boolean;

  // La versión secuencial de esta información, incrementada en cada actualización del usuario.
  version: number;

  // Información sobre su avatar, si está disponible.
  avatar?: {
    // Punteros a los assets requeridos para renderizar este avatar.
    bodyShape: string;
    wearables: string[];

    // Hex-encoded RGB/RGBA color tints for different body parts.
    skinColor: string;
    hairColor: string;
    eyeColor: string;

    // Identificadores de archivo para las "fotos" de este avatar.
    snapshots?: {
      face256: string;
      body: string;
    };
  };
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.decentraland.org/contributor/contributor-es/runtime-de-la-escena/modulos-de-runtime/players.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
