> For the complete documentation index, see [llms.txt](https://sheets.bed.codes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sheets.bed.codes/features/actions.md).

# Actions

Actions allow you to add functionality to your buttons. When a player interacts with a button, the associated actions are executed.

### Action Syntax

Actions can be defined as simple strings or as structured maps in YAML.

**String Syntax:**

```yaml
actions:
  - message: "Hello world!"
  - command: "say %player_name% clicked this!"
```

**Map Syntax:**

```yaml
actions:
  - open: "another_menu"
  - sound: "entity.experience_orb.pickup"
```

### Supported Action Types

| Action            | Description                                                                                    | Aliases   |
| ----------------- | ---------------------------------------------------------------------------------------------- | --------- |
| `message`         | Sends a message to the player.                                                                 |           |
| `command`         | Executes a command as the player.                                                              | `player`  |
| `console`         | Executes a command as the console.                                                             |           |
| `sudo`            | Executes a command as the player, bypassing permissions.                                       |           |
| `open`            | Opens another menu for the player.                                                             | `menu`    |
| `close`           | Closes the current menu.                                                                       |           |
| `sound`           | Plays a sound to the player.                                                                   |           |
| `broadcast`       | Broadcasts a message to all players.                                                           |           |
| `broadcast-sound` | Plays a sound to all players.                                                                  |           |
| `teleport`        | Teleports the player to a location or player.                                                  | `tp`      |
| `world`           | Teleports the player to a specific world.                                                      |           |
| `server`          | Connects the player to another BungeeCord server.                                              | `connect` |
| `item`            | Gives an item to the player.                                                                   | `give`    |
| `balance`         | Modifies the player's Vault balance.                                                           |           |
| `permission`      | Modifies the player's permissions.                                                             |           |
| `refresh`         | Refreshes the current menu content.                                                            |           |
| `argument`        | Sets a [local variable](/features/placeholders.md#1-multi-tier-system) for subsequent actions. |           |
| `input`           | Prompts for text input via an [Anvil menu](/features/editor.md#2-anvil-input).                 |           |

### Specialized Click Actions (Java Only)

Execute different actions based on the click type:

* `left`: Executed on left-click.
* `right`: Executed on right-click.
* `shift`: Executed on shift-click.
* `middle`: Executed on middle-click.

**Example:**

```yaml
actions:
  - left: "message: You left-clicked!"
  - right:
      message: "You right-clicked!"
  - middle:
      input:
        title: "Rename Item"
        command: "rename {text}"
```

### Input Action

The `input` action is used to get text input from the player.

```yaml
actions:
  - input:
      title: "Enter your name"
      command: "say hello {text}"
```

* `{text}`: The text entered by the player.

### Argument Action

Set local variables that can be used later.

```yaml
actions:
  - argument:
      target: "%player_name%"
  - message: "Hello {target}!"
```


---

# 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://sheets.bed.codes/features/actions.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.
