How to make a command block say something only once in Minecraft?

I am creating an adventure map and needed to know how to make a command block only say something once in the chat menu.

PS: I would like this to be under my floor because it is supposed to be an NPC talking. I also need to know how to set the radius so the text only appears when close enough to the command block.

  • What are some tactics to fortify villages and their population against outside attack?
  • Why won't my villagers breed
  • Where can I find wolves?
  • How to make a safe in vanilla Minecraft that locks and unlocks with a key?
  • How do I move a Minecraft saved world from my desktop to my server?
  • FTB Mindcrack Pack - Can't Play Properly / Extreme Lag
  • io.netty.channel.ConnectTimoutException when connecting to Mineplex
  • How to make a block disappear after a certain period of time
  • Is there a way to shut down a Nether portal with redstone?
  • Can you turn weather off in Minecraft?
  • Change existing world to superflat (server)
  • Is there a way to kill yourself immediately?
  • 5 Solutions collect form web for “How to make a command block say something only once in Minecraft?”

    Here’s a compacted device that will do what you want. Two command blocks are necessary; one for the player detector, and one for the message. I’ve labeled the blocks with example commands to use.

    Explanation:

    The six blocks in the top-left form a basic clock, which repeatedly triggers the testfor command. (The faster the clock, the quicker the detection, but higher CPU cost (“server lag”) to run it.)

    The torch of the clock activates the testfor command block at left, and (towards the right) its output is detected by the comparator, amplified by the repeater, and goes in to the command block at the right to trigger the message.

    The signal then also goes to the left-pointing repeater and into the block holding the torch. This stops the clock, so that the player test will not run again. This means that left command block’s output remains on, so the right command block won’t say anything again since it’s waiting to see the signal turn on.

    Then, to reset the mechanism (after testing, say), push the button at the bottom, which reruns the player test and thus reenables the clock, while you are out of range. (It’ll need to be longer than shown to be actually out of range.)

    The redstone dust on top of the command block is not actually necessary (it just looks better), and if you omit it the entire mechanism is only one block high so it’ll fit easier under a floor.


    If you want to do the same kind of thing for something other than a message, you can just omit the command block on the right and use the redstone output for whatever you want (as long as it also loops back to stop the clock).


    By the way: as a matter of game design, I would recommend that you not do exactly this, unless the message is purely flavor and not an important hint. Don’t make an NPC say something only once, because the player could easily miss it the first time around, or assume they could get the information again later since most games do that.

    If you simply omit the part which stops the clock (the left-pointing repeater and the wire going to it), then there will be a message each time the player enters the detection range (but not any repetitions while they are in it).

    Adding a bit more redstone logic could do things like giving a long message the first time the player is detected and a short one later times.

    You could very easily just attach a redstone block to a piston, and have that triggered by a redstone signal. Boom. Done.

    You want to use an R-S NOR latch combined with an edge detector. There are a few simplified versions that you can use if you don’t need to reset the thing, such as a single fire pulse limiter, which uses a regular piston instead of a sticky piston.

    one thing I might suggest is having the command block be paired with another command block that does something along the lines of /fill 2 2 2 stone (or whatever block you want to fill with), the second block would completely delete the first one, or you could use the copy command as the 2nd one, then, off site, you could have a number of command block sets that you could have copied and relocated to take the current command block set’s place, but you’d need it to detect a slightly different locations, like to the left, right, or straight ahead, which would make this method good for conversation paths if you were to copy signs to their respective locations too

    well, you can make it so that the redstone wire connects to a command block that says something that connects to a sticky piston that cuts off the signal of redstone and connects to an dropper on top of the pressure plate. I used this in my CTM map. 3 redstone is hidden around the map, each used in this contraption (I removed most of the walls and ceilings so you can see the whole thing) hidden in my map, used to get 3 emeralds from 3 redstone.
    contraption:

    We love Playing Games, especially Video Games.