
Command
/gamemode
Changes the game mode of players.
| /gamemode <gamemode> [<target>] |
| Argument | Kind of value | What to type |
|---|---|---|
| <gamemode> | Game mode | The game mode: survival, creative, adventure or spectator. |
| <target> | Target selector | The players whose game mode is changed. Defaults to yourself. One or more players. |
| Permission level | 2: operators, worlds with cheats on, command blocks and functions |
| Works in | Operators on multiplayer servers, singleplayer worlds with cheats enabled, and command blocks and functions. |
| Result | Reports "Set own game mode to ..." or "Set <player>'s game mode to ...". The number /execute store saves is the number of players whose game mode changed. |
| No target | Without a target the command changes your own game mode. It then has to be run by a player, so a command block or the server console must name a target. |
| Already in that mode | Players who are already in the chosen game mode are skipped without a message and are not counted. |
| Message to the player | A player whose game mode is changed by someone else is told about it, unless the game rule send_command_feedback is off. |
/gamemode creativePuts you in Creative mode.
/gamemode survivalPuts you in Survival mode.
/gamemode spectator @sPuts you in Spectator mode.
/gamemode adventure @aPuts every player in Adventure mode.
/gamemode survival @pPuts the nearest player in Survival mode.

