execute unless entity @s[type=minecraft:player] run return 0 scoreboard players set #gm noemie_mc_gm 0 execute if entity @s[gamemode=survival] run scoreboard players set #gm noemie_mc_gm 1 execute if entity @s[gamemode=creative] run scoreboard players set #gm noemie_mc_gm 2 execute if score #gm noemie_mc_gm matches 1 run function noemie_mc_gm:switch_gm/creative execute if score #gm noemie_mc_gm matches 2 run function noemie_mc_gm:switch_gm/survival scoreboard players reset #gm noemie_mc_gm