# Events

Use Cases:&#x20;

* Show HUD at game start
* "Auto unlock" quests upon entry
* Track total player count in an Experience
* Send messages to specific broadcast targets

{% hint style="warning" %}
Set **Broadcast Type** to *All* or *Rules* to send messages from objects to the Rules System.
{% endhint %}

## On Player Join

{% tabs %}
{% tab title="About" %}

### On Player Join

This rule sends a message each time a new player joins an Experience.

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FWJwHoyWkmLZ0Qrqkj93V%2Fimage.png?alt=media&#x26;token=6224ed28-344b-48e9-94c6-a5143abd404b" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Details" %}

#### Message to Send

Select the message that will be sent after a player joins.
{% endtab %}
{% endtabs %}

## On Player Exit

{% tabs %}
{% tab title="About" %}

### On Player Exit

This rule sends a message each time a new player leaves an Experience.

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FGewaSZXwdZewwLBtOXPU%2Fimage.png?alt=media&#x26;token=bd9b713b-4eef-47fe-9ed0-55e17dff31a3" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Details" %}

#### Message to Send

Select the message that will be sent after a player leaves.
{% endtab %}
{% endtabs %}

## Send Message

{% hint style="success" %}
This is the only rule that will has broadcast types.
{% endhint %}

{% tabs %}
{% tab title="About" %}

### Send Message

{% hint style="warning" %}
**UPDATED IN GAME MAKER 0.11**

This can direct a message sent from the Rules System to a more specific target.
{% endhint %}

This rule sends a message to the targets specified in the Broadcast Type field:

* **All**
* **Rules**
* **Specific tags** - add tags to broadcast to (and apply them to target objects)
* **Triggering actors**
* **Objectives (quests)**
* **Team** - select a team that has been defined in [Spawn Point](https://docs.sandbox.game/en/creator/game-maker/docs/behaviours/basic-logic/spawn-point-and-avatars-feature) behavior

{% hint style="info" %}
This rule makes the Game Rules system more compatible with gameplays that will use the new **team variable**.
{% endhint %}

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FVCdqK2JLMdykvZfCXg32%2Fimage.png?alt=media&#x26;token=bc4f5030-8f24-4ec2-8259-3044567a2018" alt="" width="308"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Details" %}

#### Required Message

Select the incoming message to trigger the rule.

#### Message to send

Select the outgoing message to be sent once the rule is triggered. Use the broadcast type to define which targets will receive the message.
{% endtab %}
{% endtabs %}

## Send Message to \[SP] Actors

{% hint style="success" %}
This is the only rule that will communicate with **\[SP]** behaviours and components.
{% endhint %}

{% tabs %}
{% tab title="About" %}

### Send Message to \[SP] Actors

{% hint style="warning" %}
**NEW IN GAME MAKER 0.11**

This rule may be used to improve performance in multiplayer Experiences.
{% endhint %}

This rule allows you to send a message:

* from the server, including messages from \[MP] behaviours and components
* to the client, including \[SP] behaviours and components

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FIFIWvGrBMAdoaoEFOgqy%2Fimage.png?alt=media&#x26;token=5f86b215-eea1-4be9-b854-36a9211e7f11" alt="" width="295"><figcaption></figcaption></figure>

{% hint style="info" %}
**MULTIPLAYER BASICS**\
In multiplayer Experiences, information is managed in two "layers":

* Server (synchronised)
  * player and object movements and collisions
  * spawned objects
  * variable data
  * quest data
  * interactive logic that must communicate with any of these
* Client (local)
  * stationary objects and their collisions
  * logic that can be managed off of the server for better performance
  * interactive logic that must communicate with any of these

Experiences play more smoothly when the server needs to manage less information.&#x20;

This rule may be used to design more efficient Experiences. It may also allow for more game mechanics and/or assets to be added. Always test thoroughly.
{% endhint %}
{% endtab %}

{% tab title="Details" %}

#### Required Message

Select the incoming message to trigger the rule.

#### Message to send

Select the outgoing message to be sent once the rule is triggered.
{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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.sandbox.game/en/creator/game-maker/docs/game-rules/events.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.
