Why do I die when I run "/kill @e [type=!player]"?

When I put

/kill @e [type=!player]

in a command block and power it, I die, even though players should be excluded. I need this command to be able to reset my mini-game map, but I don't know how to do it! Am I doing it wrong?

I've found other websites that say its just like that, so I don't know what I'm doing wrong.


I have found your problem.

Your command has a space between the @e and the type selector. Simply remove this space, and don't forget to capitalized the P.

Correct command: /kill @e[type=!Player]