If player offline script run for player script

i know you didn’t understand title, i searched if player offline on roblox game and code run for player but i didn’t found any source

if you know how to make player offline run script for player system can you help me?

This description seems very vague, what are you trying to accomplish?

1 Like

Elaborate more, don’t quite understand what you’re trying to achieve.

1 Like

Do you mean if a player is “Away from keyboard” and hasnt done anything for a certain amount of time or when a player is actually offline and not in game

like player isn’t in game but script run for player

like this

player here
player leaves
running code for player

What type of code are you going to run for the player? Once the player leaves all their localscripts don’t run anymore except for serverscripts

i making crypto mining game, and i want crypto miners work when player isn’t in game

You can simply keep an array in memory for that, and the server sided script could run code and manipulate the datastore for said player.

Any script that isnt parented to the player/ player’s character will run even if the player left

good idea, but how i can do this?

im pretty sure he wants something that works like a mobile “afk” game where the player accumulates score for how long he wasnt in the game

1 Like

Any datastore script in serverscriptservice which handles Data management with .PlayerAdded/ PlayerRemoving events can work

thanks for telling this, i try this later

I don’t know how you scripted the crypto mining part but if you have a way to get some kind of average profit every second/minute you could just make it so when the player leaves, it saves os.time() of when they left, and when they join back you just do some math to get the profit that they would’ve made if they were still online.

If you keep a script running the whole time for a player that isn’t even playing right now it would probably lag the server if too many people joined and left. Also if the player joins a different server the other server would still think that the player is offline. The way I just explained would be a lot easier.