Basically the title. I am trying to make a shop system similar to grow a garden; that is, all the servers update at the same time with the same stock. I already made a localized version of it but I can’t understand how I make it so that multiple servers don’t update it.
Is it possible for someone to make a visualization for how messaging service works and how memorystoreservice locks the updating? I’m a visual learner so it would help a lot.
Memorystoreservice shares a piece of temporary piece of data between all servers that lasts like 30 days, which can be stored in a queue (like people waiting in a line but the people are blocks of data), hashmap (like a dictionary that maps words to pieces of data) and sortedmap, which is hashmap but sorted
Im not sure how you would use messagingservice here
Messaging service sends a message from one server to all the other servers
You could probably just query the hashmap every 2 seconds (you get 120 per player + 1000 base)
Or maybe messagingservice tells servers when someone bought an item so they can query the hashmap and update only then
I’m not sure if I’m understanding correctly but basically you’re saying memorystore is like a simplified datastore for cross-server communication? I only want the stock data to be replicated on all servers and not the player buying it. every player gets their own stock they can buy but its the same.
I’m just wondering how I could interact with the memory store in section I circled below:
memory store hashmaps work exactly like datastore (string → values) but the only difference is that memory stores are temporary and more optimized for short term use
if you want the stock data to be replicated but every player has their own stock
then i think you can just use a predictable seeded rng so you dont actually have to send anything. For example if you want it to reset every day, then the start of each day has a unique timestamp which you can put into RNG = Random.new(timestamp) to generate stock randomly by using the rng like
local randomNumber = RNG:NextNumber() -- returns between [0,1] but it will be the same for all servers since they have the same seed
If you only want “one server” to interact with memory stores or data stores i think the best way is to set up your own server and then use the opencloud API to interact with stuff (you can use your own computer if you turn it on all the time) https://create.roblox.com/docs/cloud/reference/features/storage