On our server I'd like to switch people to adventure when they enter an area, but when they leave it should set them back to the game mode they were in before entering.

So my question is, is it possible to record player information in the scoreboard or a tag for their game mode and then use it later

e.g. tag @s add GameMode=[m]

  • 2
    First question is "Can I query the game mode of a player?" and I think the answer is yes. Then it's just a matter of saving the result of that query to a scoreboard objective for the player, which shouldn't be too hard.
    – MBraedley
    Commented Feb 11, 2021 at 22:34

1 Answer 1


When they enter the area do:

/tag @a[m=s] add survival


/tag @a[m=c] add creative


/tag @a[m=a] add adventure

Then just change their gamemodes back later accordingly:

/gamemode a @a[tag=adventure,r=5]


Make sure to untag them:

/tag @a[tag=survival,r=5] remove survival

You must log in to answer this question.

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