Lives are built in for that, check the lives object. You could also use a counter to control this by having the counter start at X lives and remove 1 per time the player dies in game.
Fun part...