2

I have a line of command blocks targeting @p, but they target seemingly random players. the person closest to the button will get teleported and given like 2 items, while a person 5 blocks behind them will get all the rest of the items and their gamemode updated.

I've tried rearranging the command blocks with and without chain command blocks, what do I do?

1 Answer 1

2

Your issue probably is that you are teleporting them first. The simplest solution is to call the tp command last. You might be doing:

/give @p apple #Targets nearest player
/tp @p 5 10 7 #Teleports them farther
/gamemode @p survival #Still gets nearest player, but someone else might be closer now

Simply swap the teleport command to be last:

/give @p apple #Targets nearest player
/gamemode @p survival #Changes gamemode of nearest player
/tp @p 5 10 7 #Teleports player

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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