How to detect if a player has killed a mob? Minecraft 1.15.2
You can create an objective with the minecraft.killed:minecraft.bat
which will automatically increment each time you kill a bat.
/scoreboard objectives add batKills minecraft.killed:minecraft.bat