Sorry for the nooby question, I can't believe I'm even asking this..

But how do I set the maximum number of lives?

Example:

In my game, every 5 seconds the player loses a life.

But if the player clicks on food, it will give him one life back.

I want the maximum amount of lives in my game to be 3, but at the moment if the player keeps clicking on food, he will gain unlimited health.

I tried comparing my lives to a counter, but still I'm getting the same problem I can't seem to limit the number of lives the player has.
Even after setting the maximum value of the counter to 3.

I know there must be a simple solution to this, I don't think my brains working well enough today haha.

Thanks guys.

Edit:

I solved it myself - i wasn't thinking properly haha.
For anyone else wondering this is how I fixed it:

I added a counter and made the maximum value 3 and minimum value 0.
I just replaced the numbers of the counter with the lovehearts of the 'lives' object.

simple haha, sorry for the useless post!