Can i change any values when no one is playing my game?

i know this isn’t a question about scripting, but i didn’t kno what categoty this question is for.

so i am making a swordfighting game, and one of the ways you can get the sword is through rolling. i want it so every midnight, the featured sword (sword that you will get if you get it from gacha that day) will reset. but, i imagine this game is probably pretty small, no servers are gonna be up at midnight, since no one is playing. so, can i randomize the featured sword while no one is playing the game, or i need to wait until a player joins to change it?

3 Likes

when there’s no players playing the game, there’s no server running, so, there is no script doing anything. You’ve gotta find another way like:

If a player enters the game, server should randomly choose a sword and save it into datastore with sword value and os time/day, so when that player leaves, and later another one joins, server script decides if it’s time to set up another random sword. Couldn’t understand clearly your idea, but this is a good alternative.

1 Like

check this topic, I believe it generate the same shop items based on Google’s time Api which might be useful for you.

thank you so much, the tutorial is working perfectly!

1 Like

As a heads up, using workspace:GetServerTimeNow() is better (which didn’t exist at the time of the article) and won’t require any external web calls.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.