How i can make deaths

I am working on a zombie survival game and i want to make the player die when the health reaches to 0.

The link to the game is here https://www.modd.io/play/xvrzXroNS/ but i found this How can i make death? and it was outdated for me. So how i can do that? The player should then just respawn. Also i would like for the same thing to be for AI-Controlled zombies.

2 Likes

Copy these two scripts from the Death Match template. The first one goes in your player unit’s entity scripts and the second one goes in world scripts. Also, these scripts make use of an attribute called ‘respawnTimer’. If your game does not have it, you can either create it and update the scripts to use it, or make an instant respawning system so you don’t have to use a respawn timer.
https://www.modd.io/play/9us9AXHbm/#scriptId=fighter&file=SpfDRtiuK6
https://www.modd.io/play/9us9AXHbm/#scriptId=world&file=playerRespawn

1 Like