Trouble with Real world time

I want to write a script in which my player will have a specific amount of life which resets after a day or it gets 1 life back after every hour. How do I achieve that? I also want it in such a way that players can’t get around with it by changing the time in their phone. Please help

Do you need the life to reset at 12:00am, or when the player has actually played the game for 24 hours. In other words, should it reset each day even if the player isn’t actually playing it?

If you only want time to pass by whilst the player is actually playing the game, I would keep a reference to the time passed in a variable, which is then saved when the player exits the game and loaded when they start it again. That way, you’re not referencing the clock in any way.

In all honesty, I wouldn’t worry about it too much; unless cheating saves them real money, I don’t think the players of your game are going to go to the extreme of changing the time on their phone just to cheat in the game!