I am working on a project in which i need position of a player at any tick. i used the command:

data get entity player_name Pos[0]

data get entity player_name Pos[1]

data get entity player_name Pos[2]

but i want them to be stored as variables. how can i do that. And also if possible tell me how to display variables in scoreboard

this is not the solution of my problem Minecraft using player score as a variable How can I set a player's scoreboard score to a player's coordinates [1.15.2] this is a duplicate suggested but this question dosent deals with storage in a variable

  • 3
  • @ExpertCoder14 anything that can store and change in my .mcfunction. Like in other programming language we can declare like position_z=data get entity player_name Pos[2].All I am asking is how do i assign position_z to that value. Scoreboards have their limitations and can't do that effectively Oct 18, 2020 at 16:50
  • and mess with that value. Which can't be done in scoreboards Oct 18, 2020 at 16:57
  • What do you need to do to "mess with" a value? Perhaps you just aren't using scoreboards effectively. Are you just doing basic assignment and basic arithmetic?
    – One 2 Many
    Oct 18, 2020 at 20:18
  • mcfunction is not a programming language and doesn't support things such as variables. The linked questions should enable what you're trying to do.
    – Schism
    Oct 18, 2020 at 22:45


Browse other questions tagged .