Minecraft – Why does /gamerule KeepInventory true not work?

minecraft-commandsminecraft-java-edition

I am in minecraft 1.8.9, and when I try to do /gamerule KeepInventory true, it says the command has been updated, and then I go and do /kill. But I still lose my items, both in creative and in survival. What am I doing wrong?

@Arperum mentioned in the comments that it should be keepInventory, but on some worlds, when I type /gamerule and cycle through the rules, the one with the uppercase "K" shows up. Is that a glitch?

Best Answer

The gamerule to keep your inventory is keepInventory, with a lower case "k"

/gamerule keepInventory true

You can look up the available gamerules on the wiki or in this question (which is basically copying the wiki).

The "glitch" you are observing isn't one. Since 1.8, the game allows you to add any arbitrary gamerule. Normally, these don't do anything, but you can add actual functionality via command blocks. What you are observing on some worlds is most likely that you already set KeepInventory to true, making it a valid gamerule in that particular world, hence it shows up for auto-complete.