Minecraft – How to make a button disappear and display text after being pressed

minecraft-commandsminecraft-java-edition

I have noticed in some maps they have it so once the player presses the button The button disappears and then some text comes up. I was wondering how to do that.

Best Answer

This is simple to do, but I'm not sure what kind of text you want so I display three kinds:

  • Title
  • Tellraw
  • Say

So first we will set up the command blocks like so:

You can get a command block with /give @p minecraft:command_block

Now we will leave the first one blank for now.

In the second command block you must add this command:

setblock X Y Z minecraft:air

In the X Y and Z put in the coordinates of the button.

Now going back to the first command block we will now go over the three ways to create the "text" you were talking about:

 /say

To use /say simply type in /say following what you want it to say e.g:

/say Hi there

.

/tellraw

Tellraw is far more advanced:

I will not explain it all:

/tellraw @p ["",{"text":"Hi there","color":"blue"}]

Change "Hi there" with the text you want and change "blue" to the colour you want. This looks prettier than /say .

/title

/title works similarly to /tellraw but the text appears in the middle of the screen and is far larger:

/title @a title ["",{"text":"Hi there","color":"blue"}]

The same thing that applies to /tellraw applies to /title :

Change "Hi there" with the text you want and change "blue" to the colour you want.