I need a way for a command block to say things in chat when it is powered, or more preferably whenever someone spawns into the world.
15 Answers
There are two ways you can output things to the chat.
The /say command, syntax /say <Message ...> displays a message in chat. However, this message will always have the command block's name beside it.
A command block with /say Hello World! would output:
[@] Hello World!Alternatively, the /tellraw command, syntax /tellraw <target> <json compound array/singleton> displays a message in chat, but it gives you full customization of its output from color to formatting using json formatting.
A command block with /tellraw @a {"text":"Hello World!"} would output:
Hello World!There are applications such as minecraftjson.com which generates a json string to use in /tellraw and various other commands that will give you complete control on what is outputted.
There is also a Minepedia section on the string format should you decide to write them yourself.
Use the /say command. This allows a command block to display a chat message to the entire server.
More info on the /say command on the Minecraft wiki
First of all, to detect a Player do:
/testfor @e[type=Player]In a repeating command block (always active). Then, have a chain command block (always active), connected to the first, saying:
/say <YOUR MESSAGE> 1 Just put a pressure plate where you walk/spawn under the command block and have the command as /say @a <Your message>
In newer versions, use:
/tellraw @e {"text":"MESSAGE"}If you want your words to be in color, use:
/tellraw @e {"text":"MESSAGE","color":"COLOR"} 1