How do i make it so when i get hit by an object/person the game stops

I made a shooter game close to BO3 zombies but way worse ofcourse. But i want to make it so when I get hit by a zombie (or in this case a boy) i die and the game restarts, anyone know how to do this?

You can use the command when player collides with boy exit the game, for a better experience you could learn how to use groups.

when you command that, what command is it in? is it CoBlocks Python or typescript?
Thanks

You can do it in all of them.