Since you can't modify the player's location directly, you have to summon an armor stand and modify it's location and then teleport the player to the armor stand.
step 2 -move the armor stand to the location stored in your scoreboard objectives
/execute store result entity @e[tag=point] Pos[0] double 1 run scoreboard players get <player> <x objective>
/execute store result entity @e[tag=point] Pos[1] double 1 run scoreboard players get <player> <y objective>
/execute store result entity @e[tag=point] Pos[2] double 1 run scoreboard players get <player> <z objective>
you can also create fake players to be placeholders for your scores if you don't want to assign them to a real player, like so:
/scoreboard players set x_loc_holder <x objective> <cordinate>
x_loc_holder is a fake player, now you can use this player in the previous command to get the x
just wondering... does modifying the Pos[] array change the real location like a tp does? and why can't i modify a real player's location like that?
Yes, it modifies the real location and I don't know why Mojang doesn't allow modifying the player data, probably because you would be able to set the players location in unloaded chunks or past the world border.
Self explanatory enough...So watcha got?
Since you can't modify the player's location directly, you have to summon an armor stand and modify it's location and then teleport the player to the armor stand.
step 1 -make an armor stand
step 2 -move the armor stand to the location stored in your scoreboard objectives
you can also create fake players to be placeholders for your scores if you don't want to assign them to a real player, like so:
x_loc_holder is a fake player, now you can use this player in the previous command to get the x
step 3 -teleport the player to the armor stand
Command block engineer // Developer // #TeamTrees
just what i was looking for... thx
just wondering... does modifying the Pos[] array change the real location like a tp does? and why can't i modify a real player's location like that?
Yes, it modifies the real location and I don't know why Mojang doesn't allow modifying the player data, probably because you would be able to set the players location in unloaded chunks or past the world border.
Command block engineer // Developer // #TeamTrees
This method will only work for loaded chunks, if you want to teleport the player into unloaded chunks you can use a datapack I made
https://www.reddit.com/r/MinecraftCommands/comments/dckqlu/teleport_to_scoreboard_values/?utm_source=share&utm_medium=web2x
Useful command tools:
Mr. Garretto's Command Combiner Pro
Potion Effect Creator
Command Lines by JannisX11
A question about this, would this work if I replaced double 1 with float? it seems to give an error
The X, Y and Z entries in the Pos array are doubles so that's probably why you are getting the error.
Command block engineer // Developer // #TeamTrees