Skip to main content
Back to command block basics

Messages, titles and sound effects with command blocks

Tutorial 2: a button-activated message and a four-block chain for Minecraft Java Edition 26.3.

These examples use Java Edition 26.3 syntax. Command syntax and game rules can differ in other versions and in Bedrock Edition.

1. Prepare a separate test world

First follow the basics tutorial: allow commands, use Creative mode and check that minecraft:command_blocks_work is true. On a Vanilla server, editing command blocks requires operator permission level 2 or higher; ask the administrator.

Obtain four command blocks using this player-chat command, with a leading slash:

/give @s minecraft:command_block 4

Enter every block command below without a leading slash. Use a button, not a clock or a repeating command block. Test with consenting players: @a targets all online players, not just the person pressing the button.

2. Start with one Impulse block and a button

Place one block, select Impulse / Unconditional / Needs Redstone and enter:

say DJ Library test

Confirm the input and attach a button directly to the block, using sneak-place if necessary. Press it once. Expected result: a broadcast chat message containing DJ Library test, attributed to the command block rather than your player. Wait for the button signal to end before pressing again.

3. Extend it to one Impulse and three Chain blocks

Remove the button while building. Keep the first block as Impulse / Unconditional / Needs Redstone. Place three more blocks in a straight line after it and set each to Chain / Unconditional / Always Active. Check the arrows on the blocks: the Impulse arrow must point into the first Chain block, then each Chain arrow into the next block. Do not form a loop.

Always Active lets a Chain block run when the executing chain reaches it without separate redstone power; it does not run continuously by itself. Unconditional means a later block can run even if the previous command fails. Keep all four blocks loaded and enter these commands in arrow order:

  1. Impulse: broadcast a message

    say DJ Library test

    Expected: the same command-block chat message as in the single-block experiment.

  2. First Chain block: formatted chat

    tellraw @a {text:"Library test",color:"gold"}

    Expected: all online players see Library test in gold in chat, without the say sender prefix.

  3. Second Chain block: an actionbar title

    title @a actionbar {text:"Library test",color:"gold"}

    Expected: all online players briefly see Library test in gold above the hotbar, not as a large central title.

  4. Third Chain block: a sound at each player

    execute as @a at @s run playsound minecraft:block.note_block.pling master @s ~ ~ ~ 0.5 1

    Expected: each online player hears one pling at their own position, with volume 0.5 and pitch 1, provided their client sound settings allow it.

Attach the button only to the Impulse block again and press once. A single redstone activation starts the four commands in order, without an intentional delay between them. The Chain blocks do not need their own buttons. Wait until the signal ends before another test.

4. Player chat and command block execution

In player chat, @s is the player executing the command. A command block has no player entity of its own: @s is not automatically a player or the button user. The tellraw and title examples therefore use @a explicitly.

For the sound command, execute as @a runs once as each player but does not move the execution position. at @s then sets the position and dimension to that player. Only inside this execute context does the final @s select that player; ~ ~ ~ is now their position, not the block position. This avoids playing every sound at the command block.

5. Stop, remove and troubleshoot

Remove the button and disconnect any other redstone power to prevent a new activation. A chain that already started is not undone. For cleanup, break all four test blocks or clear their command fields. Do not use Repeat blocks or a repeating redstone circuit for these messages and sounds.

If a step fails, inspect Previous Output in each block and enable output tracking if needed. Check the exact Java syntax, arrow direction, loaded chunks and all block settings. For missing sound, also check the client volume. Do not treat a successful chat message as proof that every block in the chain succeeded.