I'm working on an adventure map, and I'm completely stuck on the dialogue part of it. Is there any way to make certain villagers have certain bits of speech? For example, Villager 1 says "Hello!" and then "How are you?" when right clicked, and Villager 2 says "Greetings!" when right clicked. I've got the right click detection working, but when I try it out, they both speak at the same time. Is there a workaround for this, preferably with one command block? I'm using the latest 1.14 snapshot.

  • Please give the commands you're using. The solution will depend heavily on how you're detecting clicks and how you made the speech part. Commented Dec 16, 2018 at 0:54

1 Answer 1


Firstly, make a scoreboard objective for talking to villagers.

/scoreboard objectives add talk minecraft.custom:minecraft.talked_to_villager

Then, run this in a repeat command:

execute as @a[scores={talk=1..}] at @s positioned ^ ^ ^2 run tag @e[type=villager,limit=1,sort=nearest] add talk

That executes all players who have right clicked a villager to tag the nearest villager from two blocks in their direction with the talk tag. (Keep in mind that for this to work the villagers must not have any trades. I'm not sure if this works in 1.14, but if so summon them with {Offers:{}})

For this next part to work each villager must have a unique tag or score. Run this in a chain command:

execute as @e[type=villager,tag=talk,tag=<uniquetag>] at @s run tellraw @a[distance=..4] <insert text>

Run that command for each villager before continuing.

Then remove the talk tag from all villagers and reset all talk scores in repeat command blocks.

tag @e remove talk
scoreboard players reset @a talk
  • 1
    Thank you, this was exactly what I was looking for! I had everything set up like that, except for the positioned thing in the execute command!
    – 4P5
    Commented Dec 16, 2018 at 19:00
  • Welcome! I have a question for you, though - how do you put command synax in those little grey boxes? Commented Dec 17, 2018 at 16:55
  • 1
    Just put 4 spaces before the box!
    – 4P5
    Commented Dec 17, 2018 at 21:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .