I'm cloning blocks in the x direction -1 at a time. I want to keep all players on these blocks with them so I teleport the player -1 relative to their current Pos[0] or X.

This works for me when the function is run from a repeating command block calling a datapack function as follows.

clone ~-9 ~-1 ~-2 ~63 ~5 ~2 ~-10 ~-1 ~-2 replace force

execute at @p run tp @p ~-1 ~ ~ 

As I'm executing the command @p

However this will not work for others. I do have a scoreboard to tell if a player is on the blocks so I can execute another function based on that scoreboard from this function. However I have tried multiple combos to get the other players in multiplayer mode to move -1 block in the x direction to no avail but I do move.


To clarify what @Fabian Röling meant, the reason your commands do not work is because you are using the @p selector instead of the @a selector. Your command, execute at @p run to @p ~-1 ~ ~, means run this command at the nearest player and teleport the nearest player to that position -1 blocks in the x direction.

What you really want is

execute as @a at @s run tp @s ~-1 ~ ~

which means run this command as all players, respecting each of their positions, and teleport each of them relative to their position -1 blocks in the x direction.

If this isn't what you want, I recommend clarifying your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.