> For the complete documentation index, see [llms.txt](https://docs.sandbox.game/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sandbox.game/en/creator/game-maker/docs/components/triggers/switch.md).

# Switch

{% hint style="success" %}
**COPY/PASTE PARAMETERS**

New in GM 0.11! Right click on a behaviour or component to copy. Then open an object, add the same behaviour or component, and right click it to paste identical parameter settings.
{% endhint %}

{% hint style="info" %}
**NEW GAME MAKER 0.9 FEATURE**

Create new types of puzzles where two states of a message would be needed, such as a lever code.
{% endhint %}

<figure><img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FXqdbNvrG0v5oHWlyHxdc%2FSwitch%20component%20states.webp?alt=media&amp;token=6646baa4-cb42-41a9-93c7-1feb90edb570" alt=""><figcaption><p>Shown: The <strong>Switch</strong> component's states can trigger doors, platforms, VFX, and more. <br>To visualise states A and B, Animated Decoration behaviour displays a lever in on/off positions.</p></figcaption></figure>

{% hint style="info" %}
[Build Singleplayer & Multiplayer Logic](/en/creator/game-maker/docs/build-singleplayer-and-multiplayer-logic.md) - about <mark style="color:green;">**\[SP]**</mark> or <mark style="color:yellow;">**\[MP]**</mark> behaviours or components
{% endhint %}

## <img src="https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FA1RgLoh3TRchunv6JWXv%2Fimage.png?alt=media&amp;token=f39998ba-f216-48f1-82e6-c0bc8583c556" alt="" data-size="line"> Switch  <mark style="color:green;">\[SP]</mark> <mark style="color:yellow;">\[MP]</mark>

When a state (A or B) is triggered, send a specified message.

## Common Uses

* Create logic for puzzles with two different types of messages
* Avoid using Door behaviour, which is only available in \[MP], to send messages to \[SP] and \[MP] objects depending on the state of the door (opened/closed).
* Communicating messages to the Rules system when an object's state is triggered.

## Communications

|                                                                 |                                                               |
| --------------------------------------------------------------- | ------------------------------------------------------------- |
| **Inputs:** One or more messages to trigger each state (A or B) | **Outputs:** One message out depending on the state triggered |


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sandbox.game/en/creator/game-maker/docs/components/triggers/switch.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
