Command to say player coords in chat?

[BACK]
Command to say player coords in chat?
Posted On: January 28, 2023

Trying to get a command that tells a player's coords in chat. I have a working command: /data get entity @s Pos, but I assume I would need to combine this with /tellraw?


Question from user Aceplante at gaming.stackexchange.com.


Answer:

You can do that using just tellraw:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"nbt":"Pos[0]","entity":"@s"},{"text":" Y:"},{"nbt":"Pos[1]","entity":"@s"},{"text":" Z:"},{"nbt":"Pos[2]","entity":"@s"}].


That is going to display the coordinates but in the form of a decimal number with a lot of digits. If you want to display whole numbers, what you can do is store the values into scoreboard objectives (storing them converts them to integers) and then display the objectives using /tellraw.


This is how you store the coordinates into objectives:.


/execute store result score @s x run data get entity @s Pos[0].


/execute store result score @s y run data get entity @s Pos[1].


/execute store result score @s z run data get entity @s Pos[2].


And this is how you display the values:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"score":{"name":"@s","objective":"x"}},{"text":" Y:"},{"score":{"name":"@s","objective":"y"}},{"text":" Z:"},{"score":{"name":"@s","objective":"z"}}].


Answer from user MegaCrafter10 at gaming.stackexchange.com.


[BACK]
Command to say player coords in chat?
Posted On: January 28, 2023

Trying to get a command that tells a player's coords in chat. I have a working command: /data get entity @s Pos, but I assume I would need to combine this with /tellraw?


Question from user Aceplante at gaming.stackexchange.com.


Answer:

You can do that using just tellraw:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"nbt":"Pos[0]","entity":"@s"},{"text":" Y:"},{"nbt":"Pos[1]","entity":"@s"},{"text":" Z:"},{"nbt":"Pos[2]","entity":"@s"}].


That is going to display the coordinates but in the form of a decimal number with a lot of digits. If you want to display whole numbers, what you can do is store the values into scoreboard objectives (storing them converts them to integers) and then display the objectives using /tellraw.


This is how you store the coordinates into objectives:.


/execute store result score @s x run data get entity @s Pos[0].


/execute store result score @s y run data get entity @s Pos[1].


/execute store result score @s z run data get entity @s Pos[2].


And this is how you display the values:.


/execute as @p run tellraw @a [{"selector":"@s"},{"text":"'s coordinates are X:"},{"score":{"name":"@s","objective":"x"}},{"text":" Y:"},{"score":{"name":"@s","objective":"y"}},{"text":" Z:"},{"score":{"name":"@s","objective":"z"}}].


Answer from user MegaCrafter10 at gaming.stackexchange.com.


[BACK]

Broom races vs. type of broom Broom races vs. type of broom

Posted On: September 7, 2023
I got annoyed in previous playthroughs that I would miss the winning time by 10+ seconds or multiple hoops. This playthrough I picked a different broom from Albie Weeks, the one that mentions 'sta...[More]


What's the Path of Least Resistance for Honor Mode? What's the Path of Least Resistance for Honor Mode?

Posted On: November 11, 2025
I really wanna get it done, I know the basics, talk down Lump and the goblins in the village, wander around and get Karlach, free Slazza, what's everything that you should be doing to get high enough ...[More]


Dueling in Hogwarts Legacy Dueling in Hogwarts Legacy

Posted On: August 28, 2023
EDIT Thank you to everyone who commented with your advice! I admit I started getting frustrated and my bf had to take over as PVP isn't usually my thing in video games! (I usually do Minecraft, st...[More]


How do you keep playing in a journey? How do you keep playing in a journey?

Posted On: March 23, 2026
Maybe it’s more a rant than a support request. .I really have a problem with the tons of choices this game has. Actually, the problem isn’t the choices but the fail tests. .Everytime I fail someth...[More]


How can I change the death wait to 1 second in COD4: Modern Warfare in free for all games? How can I change the death wait to 1 second in COD4: Modern Warfare in free for all games?

Posted On: April 7, 2024
I host a server for me and my friends (Call of Duty 4 : Modern Warfare). We all enjoy playing hardcore but loath the wait (10 seconds after every death). I found some commands for the server console...[More]


Is it just me or is there something wrong with Professor Garlick? Is it just me or is there something wrong with Professor Garlick?

Posted On: September 5, 2023
Is it just me or is there something wrong with Professor Garlick? Was it really just accidents her former herbalism teacher suffered, or did Garlick have something to do with it? I mean, she fel...[More]


Love the game but… do our decisions matter in Hogwarts Legacy? Love the game but… do our decisions matter in Hogwarts Legacy?

Posted On: March 22, 2023
Could we get a sim mode where our decisions actually effect the game play loop, things like a curfew system that matters and having to get to class on time have good rest a food and drink need be able...[More]


The last thing I expected from this game. The last thing I expected from this game.

Posted On: September 16, 2023
I'm on my first play through as a Hufflepuff witch, and I have to say I'm bowled over by the outfits and how good they look. The costume design team have done such a good job. My wardrobe is s...[More]


Why does my map have exclamation points marked on it? Why does my map have exclamation points marked on it?

Posted On: April 19, 2024
I have just started playing and some locations on my compass have an exclamation point marked and I have no idea what this is telling me. I have highlighted it below.What are these exclamation points ...[More]


Unforgivable curses in Hogwarts Legacy? Unforgivable curses in Hogwarts Legacy?

Posted On: April 4, 2023
Does anybody find it a bit odd that the unforgivable curses are seen as mega bad, yet diffindo where you are literally slicing someone or turning someone into a chicken is fine? Question from user ...[More]