Minecraft – How to stop bats from spawning in minecraft

minecraft-commandsminecraft-java-edition

So i'm trying to build a Five Nights at Freddy's 2 map on Minecraft but bats keep spawning I tried to kill them but there are to many to kill and I tried this command /gamerule Domobspawning false but that didn't work and /kill @e[type=bat] I have no idea how to get rid of bats

Best Answer

Gamerules are case-sensitive, and you can create your own gamerules. The correct gamerule is "doMobSpawning", while you've created a custom gamerule called "Domobspawning".

/gamerule doMobSpawning false

Savegame IDs are also case-sensitive. The correct ID is "Bat", not "bat".

/kill @e[type=Bat]