I am creating a system that requires data to be stored for a short period of time. It needs to carry data just long enough to get to a new place where it can be decoded and change the place accordingly. I am saving the data within a table.
I don’t want to use DataStores because they are not fast and temporary, and I’m not sure how to use MemoryStoreService in a way that would be able to save a table and differentiate between the different user lobby data.
Any advice to how I could do something like this would be much appreciated!
Look at MessagingService if you just want to deliver table data but are able to deal with potential failure (it says on the hub to not use it if delivery is critical). Otherwise, you can only do MemoryStoreService, it is literally made for what you’re asking for. You should instead show your attempt at using MemoryStoreService, asking for help along the way for errors/problems.
There is not really much context so I can’t help further for differentiating between different user lobby data.
I have not used MemoryStoreService, so I’m not really sure how it works. I plan to save some settings data temporarily so that I can teleport a few players and retrieve that data in a new place. Is a queue like a key in DataStoreService? Should I make a new one for every user so that I can temporarily save the table in that new queue? If it doesn’t work like that, how can I tell the different tables apart for the different users?
Sorry for late reply lol. If this is the case, why not just use TeleportData and use player:GetJoinData() to bring data from one server to another without the need of using any saving at all?
A queue is not like a key in DataStoreService, I assume you’re talking about GetQueue, the actual key is the “name” argument (first argument). You receive the queue instance from that.
You don’t have to make more than one MemoryStore, you can just add an item for each player in one queue. How can you tell different tables apart? Try using player.UserId as unique keys?
Even if the documentation isn’t descriptive, there are tutorials out there. Here’s one, here’s a hub one.
I ended up testing TeleportService and its option to keep data saved locally (hence why I didn’t do it, because of security flukes)
Then, I tried MessagingService with game:BindToClose(). It seemed working fine but with a few break ups sometimes since the new server I got teleported into took a bit more time than needed, thus making the request in the previous server send whereas the new server wasn’t properly open. (rare case, but it happens)
I really advise you to use [MemoryStoreService (MemoryStoreService | Roblox Creator Documentation), as it is meant for this ! Even though it is something new for you, you will still learn things & it is honestly the best way of doing this today.
I’ve already figured out that that’s the service I want to use for this, I just can’t figure out how to make it work. The documentation isn’t very descriptive. I would gladly use this if you could please clarify a few things.
local MemoryStore = game:GetService("MemoryStoreService")
local Queue = MemoryStore:GetQueue("HeistLobbyInformation")
local LobbySettings = {}
local UserId = Player.UserId
Queue:AddAsync(UserId, 30, 1)
Here is a bit of example code. What I want to do is pass through not only the UserId to distinguish the different tables, but I also want to pass through the lobby settings table too. How do I achieve this? Would I have to put the UserId inside the table and use a for loop to decode which table belongs to which user, or is there a better way?
Are you trying to achieve a lobby that teleports you in the real game with proper settings?
If yes:
Then you can use the system of TeleportService to keep data across teleportation. The reason I didn’t use this is because I transport really “sensitive” stuff I couldn’t reverify upon arrival (for instance money, …). In your case, since it’s only settings, you can of course use this for it is meant for this.
The settings being transported are intended for the server, not the clients. They are just as sensitive, as they can alter money and experience recieved, and activate certain cheats. I would like to use MemoryStore for upmost security.