/gamemode

/gamemode
Permission level
required
  • 2 ‌
  • 1 ‌
Restrictions

Cheat only‌
No editor

Sets a player's game mode.

Syntax

  • Java Edition
gamemode <gamemode> [<target>]
  • Bedrock Edition
gamemode <gameMode: GameMode> [player: target]
gamemode <gameMode: int> [player: target]

Arguments

JE: <gamemode>: gamemode
BE: gameMode: GameMode: enum and gameMode: int: int

Specifies the new game mode.
Must be one of the following:Note that "hardcore" is not a valid option, as it is technically not a game mode.

JE<target>: entity
BE: player: target: CommandSelector<Player>

Specifies the target(s). If not specified, defaults to the player who executes the command.
Must be a player name, a target selector or a UUID‌. And the target selector must‌/should‌ be of player type. In Bedrock Edition, the target selector should be of player type.

Result

CommandTriggerJava EditionBedrock Edition
AnyThe command is incomplete, or any argument is not specified correctly. Unparseable Unparseable
gameMode: int is not a valid game mode id. N/A Failed
player: target is a target selector that is not in player type.
<target> or player: target fails to resolve to one or more online players. Failed
<target> or player: target is not specified when the command's executor is not a player.
OtherwiseSuccessful

Output

CommandEditionSituationSuccess Count/execute store success .../execute store result ...
AnyJava EditionOn fail000
On success11the number of players whose game mode is changed.
Bedrock EditionOn fail0N/AN/A
On successthe number of targeted players.N/AN/A

Examples

  • To put the executing player into Creative mode:
    /gamemode creative
    /gamemode c
    /gamemode 1
  • To put all players into Survival mode:
    /gamemode survival @a

History

Java Edition Beta
1.8Pre-releaseAdded /gamemode <player> <mode>. The command requires a player and numeric gamemode.
Java Edition
1.3.112w16a/gamemode is now usable in singleplayer.
Syntax changed to /gamemode <mode> <player>, where player is now optional (defaulting to the sender) and mode can be a number, or one of survival, creative, s, or c.
1.3.112w22aAdded adventure to /gamemode.
1.3.112w30aInvalid numerical game mode IDs are no longer accepted. Previously, specifying an invalid ID would place the target player into Survival mode.
1.814w05aAdded spectator to /gamemode.
1.915w43a/gamemode now displays in the chat the game mode the player switches to.
16w02aThe m selector now accepts the standard literal gamemode values and abbreviations, such as a, and adventure, and these may be negated as well (e.g., @a[gamemode=!survival]).
1.1317w45aRemoved abbreviated forms and numeric IDs.
1.19.322w45aNow this command accepts a gamemode argument, instead of literal subcommands.
Pocket Edition Alpha
v0.16.0build 1Added /gamemode.
Functionality is almost equivalent to Java Edition 1.10 usage, except /gamemode can only use Creative and Survival modes.
Pocket Edition
1.1.0alpha 1.1.0.0Added adventure to /gamemode.
Bedrock Edition
1.18.30Preview 1.18.30.21Added 6 to access Spectator mode.
1.18.31
Experiment
Spectator Mode
Added spectator to access Spectator mode.
Spectator mode is now locked behind its own experimental toggle.
1.19.30
Experiment
Spectator Mode
Preview 1.19.30.20Spectator mode can no longer be accessed via /gamemode 6.
1.19.50Preview 1.19.50.20Spectator mode is no longer locked behind experimental gameplay.

See also

  • /defaultgamemode‌ – sets the initial game mode for players joining the world.

Navigation