> 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/status/toggle.md).

# Toggle

{% 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 %}

<figure><img src="https://4251931498-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MO_j99BJEXK4zHqxgqS%2F-MOp3laStrSuTsUM40M9%2F-MOp5k-pVie2nfHPwtfv%2FSwitcher.gif?alt=media&#x26;token=47f02c46-48d2-4345-878f-67491a0b6434" alt=""><figcaption></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 %}

## ![](/files/s11pMtBt4HmnbwYz8lsb) Toggle <mark style="color:green;">\[SP]</mark> <mark style="color:yellow;">\[MP]</mark>

* Allows to switch the object's behaviour on, off, or toggle on/off when a message is received
* Includes a setting for its initial state

## Common Uses

* Make enemies peaceful until you touch their treasure
* Grant access to new areas - turn on or off a platform, unlock a door, etc.
* Control the player's ability to trigger certain dialogue depending on their progression in an Experience ([quest dialogue states](/en/creator/game-maker/creative-guides/logic-guide/text-quests-and-icons.md#dialogue-states-for-quests))

## Communications

<table data-header-hidden><thead><tr><th width="413"></th><th></th></tr></thead><tbody><tr><td><p><strong>Inputs:</strong></p><p>One or more on message</p><p></p><p>One or more off message</p><p><br>One or more toggle on/off message</p></td><td><p><strong>Outputs:</strong></p><p>Object's behaviour switches on</p><p></p><p>Object's behaviour switches off<br><br>Object's behaviour switches to the opposite state</p></td></tr></tbody></table>

<img src="/files/MdQYjzphWG93nU2V5J9p" alt="" class="gitbook-drawing">

## Parameters

| Options                          | Details                                                                                                            |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| ![](/files/660Y9W4d6o7eRmhJdlNW) | **Turn ON Message** - Defines the message(s) required to turn on the behaviour.                                    |
| ![](/files/O5fvfyTrKOgw2bWMogYV) | **Turn OFF Message** - Defines the message(s) required to turn off the behaviour.                                  |
| ![](/files/9oQf7a5NECxI8IbzWKyU) | **Toggle Message** - Defines the message(s) required to toggle ON/OFF the behaviour.                               |
| ![](/files/RrDBqjJH2uCrtAESRd4q) | **Initial Behaviour State** - Defines if the asset Behaviour is ON (true) or OFF (false) at the start of the game. |


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.sandbox.game/en/creator/game-maker/docs/components/status/toggle.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
