> 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

Turn the Behaviour of the Object on or off using Messages.

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

## ![](https://331512196-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F83PS3g9zpWmq73xzlwFn%2Fuploads%2FpvQ37hvZsM8OoxPTibkV%2Fimage.png?alt=media\&token=e5d1560b-bfb4-4e26-a79a-b2f2241ae0ee) 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="https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/GOGlCpHcoggSEoPtJBBr/file.excalidraw.svg" alt="" class="gitbook-drawing">

## Parameters

| Options                                                                                        | Details                                                                                                            |
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/E3c90nZPL56xzLfbOA2g/1.png) | **Turn ON Message** - Defines the message(s) required to turn on the behaviour.                                    |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/xnO6xUHsKgSjGalY2E3E/2.png) | **Turn OFF Message** - Defines the message(s) required to turn off the behaviour.                                  |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/JdZy4Xgza9RnPu8oxl00/3.png) | **Toggle Message** - Defines the message(s) required to toggle ON/OFF the behaviour.                               |
| ![](https://content.gitbook.com/content/83PS3g9zpWmq73xzlwFn/blobs/TJU0TCgco4C5GFXXlcsk/4.png) | **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 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/status/toggle.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.
