Set gamemode of a player within a radius to Survival with Command Blocks [duplicate]

I've been trying it for two weeks and it still doesn't work. How do I set the gamemode of a player within a certain radius Survival with Command Blocks?


The way I do it doesn’t make a radius, but does make a vicinity. The command to use would be “/gamemode survival @p[dx:,dy:,dz:]” With this command, you have to put the command block in the corner where the numbers imputed ends up outlining your designated area. For example, if you put the command block at 0,0,0 and your dx was 10, dy was 2, and dz was 10 then all coordinates would have that number added on the the 0,0,0 so the complete opposite corner of your area would be x:10, y:2, z:10. Hope this helps.


If you’re playing on minecraft bedrock edition, the simplest way is to grab two command blocks, assuming you want people to be in survival only when they are within that radius and that the radius is 10 (I’m just using this as an example, replace this number with the radius you actually want to use). Otherwise, just use the first command block and forget the second.

In a repeating command block: gamemode s @a [r=10]

In another repeating command block: gamemode c @a

Edit: Of course, set the first command block to “always active” after placing the second one. Otherwise, you’re going to have to use a setblock command to delete it and restart again.


Give yourself a command block, place it, set it to repeat

Use this command (console):

/gamemode s @a[r=10]

or this command (Java):

/gamemode survival @a[distance=..10]

you can choose any other radius instead of 10.