Article Categories
- Baldur's Gate 3
- Diablo
- Elder Scrolls
- General
- Hogwarts Legacy
- League of Legends
- Minecraft
- Pokemon Go
- Sims 4
- StarCraft
- Steam Platform
- Xbox Game Console
More Articles
Command to say player coords in chat?

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.

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.
Is it just me or does Professor Hecat from Hogwarts Legacy look like Gabbie Hanna?
Does completing Sly 1 to 100% give anything other than artistic content?
How to mute squad member in Call Of Duty Warzone 2.0 DMZ
Redstone door lock (memory cell)
How much Gold would Zevlor have given me for killing the Goblins?
Any tips for a new Hogwarts player?
Anyone else doing this in Hogwarts Legacy?
Minecraft Powering a redstone torch on a block adjacent to a redstone lamp without powering the lamp
Defeating the helicopter in Split Second
Is Hogwarts Legacy worth getting?


