I have made it so any one entering an area is switched to adventure game mode and then when he leaves the area he is switched back to survival.

How ever I am trying to do the same thing else where in the game but the code that is changing everything to survival beyond building one when they leave is affecting the code for building two when you enter.

What happens is the game mode is constantly changed indefinitely between survival and adventure mode.

The code I am using for the command blocks are:

/gamemode 2 @a[r=60,m=0]
/gamemode 0 @a[rm=60,m=2]

Bother buildings use the same code except the numbers are different due to the radius I am covering so building two has a radius of 30.

So what I'm asking is, how can I make it so I can enter and leave both buildings and have the game mode changed to adventure on entry and survival went vacated without the code of both buildings conflicting with each other?

Just to clarify that the command blocks reside below each building.

I'd be greatful if anyone could solve this for me.

3 Answers 3


Well the radius is mesured from the comand block. So if you put both command blocks in the same area it changes them constantly. What you can do is try to summon a invisible armor stand in the center of the area with /summon ArmorStand ~ ~ ~ {Invisible:1, CustomName:ArmorGuy,CustomNameVisible:0} then do /execute @e[name=ArmorGuy] ~ ~ ~ your gamemode command. I'm not sure will it work cause I'm sitting on my bed and typing with tablet.


What the problem here is that the [rm=60] part of the command syntax affects everything outside of the command blocks radius, including fields where there is a contradicting command block.You need to set an [r=60] as well so only players 60 blocks away from the command block witness a change. Apply this anywhere to protect your command zones.



Put this command into a command block and set the status to repeating always:

/gamemode 2 @a[r=60]

You must log in to answer this question.

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