1

I am trying to make a map that makes you say something in Minecraft chat, but if I use the /say command, it will make a symbol that is [@]. But, for /tellraw, it needs to be a specific player. Is there a way I can make someone speak in chat without the [@] and without using a specific name, so it matches the player's name?

2
  • Hi Jayden, Welcome to Arqade!
    – Alex
    Commented Sep 1 at 21:59
  • I don't really play Java Edition, but in Bedrock, I know if you name your command block, and you use /say, it will say what you wrote with the title as the name of the command block.
    – Alex
    Commented Sep 1 at 21:59

1 Answer 1

5

Method 1: /execute

You can make the player seem to say something by running the say command as them. This is what the execute command is for. You can do something like this:

/execute as @p run say It's not safe here.

This will result in the following being printed to chat (assuming my username):

[Hipposgrumm] It's not safe here.

Method 2: JSON Selectors

If you're looking for something more convincing, you can use tellraw with the "selector" component. For example, this:

/tellraw @a [{"text":"<"},{"selector":"@p"},{"text":"> It's not safe here."}]

This will effectively impersonate the player. The result (assuming my username) would be this:

<Hipposgrumm> It's not safe here.

If you like to autofill your selectors, you can combine the two methods like this:

/execute as @p run tellraw @a [{"text":"<"},{"selector":"@s"},{"text":"> It's not safe here."}]

Note: For Method 2 work on Bedrock Edition, the JSON data will need to be formatted for the Bedrock Edition version of tellraw.

You must log in to answer this question.

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