Currently, I have a queue with memory store service and I’m not sure how to get the values from the queue to call on it for events.
local ReplicatedStorage = game:GetService("ReplicatedStorage");
local StartQueue = ReplicatedStorage.StartQueue;
local MemoryStoreService = game:GetService("MemoryStoreService");
local QueueTable = MemoryStoreService:GetQueue("QueueTable");
local PlayersInQueue = {};
local k_Expiration = 3000;
StartQueue.OnServerEvent:Connect(function(player)
local userId = player.UserId;
local MMR = player.stats:FindFirstChild("MMR");
if (not MMR) then return; end
if (PlayersInQueue[userId]) then return; end -- check if player is already in queue
table.insert(PlayersInQueue, userId)
local Success, ReturnValue = pcall(QueueTableReference.AddAsync, QueueTable, {userId, MMR.Value}, k_Expiration);
if (not Success) then
warn("Error while adding player to global queue! Error message: " .. ReturnValue);
else
-- make sure the player doesn't get added to queue more than one time
PlayersInQueue[userId] = player;
end
local Return = pcall(QueueTableReference.ReadAsync, userId, QueueTableReference, 1);
print(Return)
end)
At the end of the script the Return value printed out is false. This was a test to try to pull values. So I could make an event that happens once queue reaches 10 players.
But I’m not sure where to go from here?