Can I program command blocks to make one specific area survival?
I’m making a spleef minigame in my world and i want literally just the arena to be survival. Is there a way i can make it so that the players go survival when in the arena and the creative when out?
I’ve tried so many different commands and NOTHING is working please help.
I’m playing on bedrock PC
I’ve tried so many different commands and NOTHING is working please help.
I’m playing on bedrock PC
Commentaires
* Downvote this comment if this post is poor quality or does not fit the purpose of r/Minecraft
* Downvote this comment *and report the post* if it breaks the [rules](https://www.reddit.com/r/Minecraft/wiki/rules)
----
(*Vote has already ended*)
/execute as @a if entity @s[x=<corner of selection area>,y=<y value of area>,z=<corner of selection area>,dx=<difference in the x value for the two corners of the selection area>,dy=<difference in y values for the selected area>,dz=<difference in z value of the selection area>] run gamemode @s survival
This should work for you. With the dx and dz be careful as it takes into account positive and negative as well. So if the corners are x:-325 and x:-350 then it would be x=-325 dx=-25, same thing is applied with the z coordinate. Hope this helps. To turn them back to creative if they leave that area then it is slightly more complicated but not too difficult.
Start by running the command
/scoreboard objectives add survival dummy
Then in the repeating command block replace the gamemode survival part with scoreboard players set @s survival 1
Then make a new repeating command block also set to always active.
/execute as @a if entity @s[scores={survival=1} run gamemode @s survival
Then in a new repeating command block, always active
/execute as @a unless entity @s[<do the x,y,z,dx,dy,dz stuff again>] run scoreboard players set @s survival 0
New repeating command block always active
/execute as @a if entity @s[scores={survival=0} run gamemode @s creative
Doing this should work. I’ve done things just like this before and if I remember correctly that is how it is done. If it doesn’t work it is most likely due to a syntax error. Run it through ChatGPT and ask it to check for syntax errors. Hopefully that will work. Hope this helps and good luck.
Make sure the command blocks are always active and on repeat, bedrock can be finicky with the coordinate syntax sometimes