Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

How do I put a player's name in a /title command?

Writer Sophia Terry

So, long story short, I'm trying to have a title displayed so that it says something like, "CACox97 has won the game!" with the basic command like "@p has won the game!"

My command so far is (ran in command block):

titleraw @a title {"rawtext":[{"text":" ","extra":[{"selector":@p"}],"text":" has won the game!"}]}

If you try to run that command, it'll just say, " has won the game!"

I'm playing Bedrock Edition 1.11.4.

3

3 Answers

This command will tell a random player what their name is:

/execute @r ~ ~ ~ title @s title Your name is @s

I'm not sure how to do a command that puts a player's name in titles, but I do know a lot about the title commands themselves.

The easiest way to use the title command is as follows:

/title [player] [title¦subtitle¦actionbar] [titleText]

Where [player] is the target player (@a or @p works here), [title|subtitle|actionbar] determines where the title displays, and [titleText] dictates the actual text displayed (you can use the § symbol followed by a number 0-9, or a handful of different letters, before your text to change the colour or format of the text displayed).

For example:

Say you wish to tell all players within a 3-block radius of coordinates 301,29,150 that they have successfully completed a task. You can use the following command:

/title @a[x=301,y=29,z=150,r=4] title §4§L You have successfully completed your task! Congratulations!

The font code §4 will make all the following text appear red, while §L will make all following text appear bold (you must use a lowercase L, not uppercase, but I used uppercase here to make it easier to see what character I was using). So, §4§L will make all following text appear bold and red.

Note that I used r=4, rather than r=3, to dictate the radius; when specifying a radius in commands, you should always add 1 to your desired radius, or it wont work as intended.

Also be aware that this radius also includes 3 blocks above, below, and in all other directions around the target coordinates, so be sure to properly distance other areas accordingly.

You can also set chain command blocks to display a subtitle to accompany the title, or set the entire thing to just a subtitle or display in the action bar (the action bar is where, for example, the name of a named item appears when held in your main hand, directly above the hotbar)

I'm late to the party, but try this:

title @a title @p has won the game!

you can replace @p with whatever you want, like a tag or something similar.