I want to make a global rotation that changes every hour, but i dont know how i would make this.
By global rotation, i mean a skin or a cosmetic that is on sale for an hour, then after an hour it changes globally.
I know i can use data store, but how would i only change the value once if there is multiple sessions open? And what if no sessions are open? Then how would i even change it?
you provided literally zero context to what you’re trying to do. what do you even mean by global rotation? are you trying to rotate an object? this whole post looks like it was ai generated
Okay well i mean a global rotation like a shop for example, every hour it rotates and a new skin is on sale, this is what i am trying to do here, just don’t know how to execute it.
Thank you! But how would i change the actual item that is on rotation? If there is more sessions, wouldn’t it change multiple times? And if there isn’t any sessions, could it even change?
There’s a host server that hosts the shop refreshing. When the time comes to refresh, the host server will pick the item and write it to the memory store.
Each hour, each server will read from the memory store and update the cosmetic.
For servers:
When checking for the cosmetic, each server first checks if there’s a host server currently in control. If not, it will attempt to take control and it will lock the store (e.g. with game.JobId).
When the host server closes, it releases the lock from the memory store.
Yeah, the server in control will update it each hour and the other servers read the value. Dynamically changing the host server if it shuts down should stop issues with no server being in control.
True, but if no servers are up there’s no need for a random shop. If one server is up, it is the host server. It also adds easier integration for things like item stock, as the memory store can just be updated.
What do you mean? You can handle all item data in roblox or have an external server in which it will read from every hour. I don’t think that would make it all that easier as long as you have an organized way of storing data about objects in your game.
Edit: Still even if you have external database of items and stock, my way of checking to see if the shop should be updated would be the most effective and simplest.
Using memory stores would be better to integrate things like global stock, because, well, you can’t make a global stock system using only a seed and a pseudorandom generator.
Using memory stores would be easier because it is free (i know there are some free hosting sites for an external server but if there’s enough traffic they can begin to charge) and also it stops inconveniences and security floors like:
Bad actors and denial of service attacks on your external server
Writing the code (probably in JavaScript) for the server
Securing on both ends
It also stops the (small) vulnerability of having http requests enabled on your game if thats the only thing
But yeah, if it’s only a rotation system and nothing else that can’t be done with a seed and pseudorandom generator is ever added, your solution would be better.
Well sure, if you want to store information about every item in the shop possible, it would be best. I simply assumed the scope of this question didn’t even come close to what you’re suggesting.
Couldn’t i make a giant list of items using memorystoreservice, then i take one using the current seed, for example if the seed is 3, it would take the third item in the list? And i don’t need to update it, it could just check every time you enter the shop.