Offline earning system

I know there is already a post with the similar idea, but I couldn’t make what I want work with that so I wanted to see if anyone could help.

I’m making an idle game and I want to implement the system that if the player is away from the game, when he comes back, he earns the correspondent money to the time they were away.
I saw that there’s the Time(“timestamp”) and it give me the current time, but I don’t want to limit it to 24h. I wanted to implement a way to calculate, even if the player went away for some days, how long he was away. Maybe also using the Time(“mday”), Time(“mon”) and Time(“year”) but I’m not really sure how to convert that data into the right number to make the correct calculation.

Also since this is one of my first games, I wanted to stick to the basics and not use scripts, since I don’t really get how they work and I wanted to make this as simple as I can for a first time and learn as I make new projects.

It doesn’t give current time. It gives the number of milliseconds that have passed since January 1, 1970 (UTC)


timestamp won’t limit it to 24 hours. I’m guessing you’ve read my response in this post and misunderstood it.

To get the number of hours, divide the difference between 2 timestamps by 3,600,000.

To get the number of days, divide the difference between 2 timestamps by 86,400,000 (or divide the number of hours by 24).

Oh, got it. Thank you so much, I had the wrong idea of how it worked. Now it’s working properly!!

1 Like

I was thinking about it, and I have a question about the timestamp. Does it use the system time? Because I was thinking about the possibility of the player just advancing the system time and get the rewards before it’s supposed to, and I don’t want that to happen.

I don’t think it’s system time. It’s milliseconds since 1 Jan 1970. But you could test that yourself.