Is there a way to continue players data even when they have left the game?

I was thinking about making an Idle game on Roblox but I’m not sure if their is some way to keep adding to players data or currency even when they have left the game or not currently in the server at the time and when they join back it keeps on adding. Is it possible to implement this on Roblox? I know there is events that such as PlayerAdded and PlayerRemoving which runs when a player joins or leaves a game are events like Player remvoing capable of such?

If there isn’t such would this feature be interesting to add on Roblox?

I’m not 100% sure if this is the right category, just let me know if it isn’t

Thanks for reading :smiley:

You would do what most idle games do (I assume) and just calculate what the player would have earned when they rejoin. You can do this by saving the time they left along with all the other data in a datastore.

1 Like

Use a datastore lol, you will use the player removing and player added events.

Yeah that seems like a good idea, But how would you be able to see how long a player has been away from your game? That seems like what you would need too do in that scenario.

os.time() returns the current time, save it when a player leaves and compare to os.time() when they rejoin.

1 Like

That won’t work because as soon as a Player is removed from a game, the object of a Player is nil which means it won’t run or add anything if there is nothing to add it too.

Alright, I need to do a bit of some research on os.time() . Seems like something that would work. Thanks!