What do you want to achieve?
Hello everyone! I’ve been poking around with some smaller projects lately as I recently got a PC so my tools for development have been expanded a lot more. The small project I am working on currently is a recreation of the original Cookie Clicker, designed to be more faithful to the original browser game compared to other remakes seen on Roblox. What I would like to achieve, but need some help with, is detecting how long it’s been since a player joined the game last so I can provide an offline reward to players when they next join.
What is the issue?
So, my issue is that I am unsure how to exactly do this. I have some lesser experience with stuff such as os.time() making a daily reward system in the past, but I don’t know how I would get the length of time that a player isn’t in the game for. I know this can be done because there is offline reward collection for this game:
[ Pet Zoo! - Roblox](https://www.roblox.com/games/4902872857/Pet-Zoo)
So I am hoping to get some help replicating that in some way.
What solutions have you tried so far?
As I don’t know how I would attempt to try this, I have looked to see if I can get some help searching for similar topics. I believe DeltaTime can be used as it get’s elapsed time but I am not sure how I can apply it. While I am familiar with DeltaTime as well, this post here does a good job talking about it:
Though this is helpful, I would like to apply this to find how long a player is “offline,” or not playing my game, which I am unsure about how to accomplish.
As a side note if there is anything specific that can be linked so I can read it and learn some more, I would be open to receiving anything so I know better for next time.
Restating my problem just to avoid any confusion: I would like to find out how I can get the amount of time that elapses from the last time a player leaves my game to the next time they join for use in rewarding a player based on how long they are offline.