-1

I'm making my map in Minecraft and making it for several players, I want to make sure that all the players on the map could execute a command in a certain place, that is, all the players who are currently in the world could start the game when they enter a certain zone.

execute if entity @a[x=~,y=~,z=~,dx=~,dy=1,dz=~] <---- not working

1 Answer 1

0

If you want only certain players to execute "commands" in certain places, you have to use a trigger scoreboard. Then on loop you can run a similar following command to enable any players to /trigger that scoreboard.

scoreboard players enable @a[x=100,y=80,z=100,dx=9,dy=0,dz=9] trigger_scoreboard_name

This command enables a player to use the command "/trigger trigger_scoreboard_name" when they enter the bounding box of xyz(100-110, 80-81, 100-110).

Then you have to handle what happens when a player's trigger scoreboard changes.

2
  • Note: if u leave the x,y,z arguments out of the selector, they default to the command's execution position. Meaning you can "execute positioned ~-10 ~-5 ~-10 run ..." to shift the bounding box in the opposite direction.
    – sourrabbit
    Aug 23 at 18:44
  • 1
    If the players leave the region, they will remain enabled to trigger the objective. To disable their trigger, have them run /trigger <obj> add 0 when they leave. See gaming.stackexchange.com/a/382347
    – ginkgo
    Aug 24 at 18:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .