Hello AI-Brooks,
You need to make a variable with the player's lives and every time the player is hit you should decrease the lives variable until it reaches zero.
If you need more help you can send us the game link via a
private message so we can take a look at it.
Regards,
Cyberix3D