Issue with MemoryStoreQueue

RemoveAsync does not consistently remove the queue or it does, but then gives me a queue that doesn’t make sense because it deleted the 30 lines in the past and then they just reappear, or another table of 2 and up appears.

I don’t really know what to try, maybe I’m missing something with RemoveAsync or there is a way to delete the entire table at once.

Screenshots of console
ss1
image
and this just appeared 10 mins after posting this when i was at 5

local Players = game:GetService("Players")
local MSS = game:GetService("MemoryStoreService")
local MS = game:GetService("MessagingService")
local RS = game:GetService("ReplicatedStorage")
local TS = game:GetService("TeleportService")
--^ Services

local MMNS = MSS:GetQueue("MatchmakingER")
--^ Service Variables

local remotes = RS:WaitForChild("Remotes")
local addPlayerFunction = remotes:WaitForChild("AddPlayer")
local removePlayerFunction = remotes:WaitForChild("RemovePlayer")
--^ Variables in Game

local currentServer = game.PrivateServerId
local playersInQueue = {}
local currentAmount = 0
--^ tables and counters

local playersNeeded = 10

function Main()
	local plrTable = {}
	local success, err = pcall(function()
		plrTable = MMNS:ReadAsync(100, false, 0)
	end)
	print(plrTable)
	currentAmount = 0
	if playersInQueue ~= nil then
		for i, player in ipairs(playersInQueue) do
			currentAmount += 1
		end
		
		if currentAmount == playersNeeded then
			print("Game Found")
			currentAmount = 0
			for i, player in ipairs(playersInQueue) do
				MMNS:RemoveAsync(player.Value)
				print(player.." Teleporting")
				--teleporting stuff
			end
		end
	end
end

function Add(plr)
	local success, err = pcall(function()
		MMNS:AddAsync(plr.Name, 99999, 1)
	end)

	if success then
		Main()
		print("Player Added to Queue: "..plr.Name)
	else
		print(err)
	end
end

function Remove()
	print("ry") -- temporary until I fix this
end

game.Players.PlayerAdded:Connect(function(plr)
	Add(plr)
end)

game:BindToClose(function()
	local plrTable = MMNS:ReadAsync(100, false, 0)
	for i, player in ipairs(plrTable) do
		MMNS:RemoveAsync(player.Value)
		print(player.Value)
	end
end)

solved. player.Value was incorrect, should of known because it was not printing
instead player
Identifies the items to delete. Use the value returned by MemoryStoreQueue:ReadAsync .
misread that^

nevermind

game:BindToClose(function()
	local mmnsReset = MMNS:ReadAsync(100, false, 0)
	MMNS:RemoveAsync(mmnsReset)
end)

insert entire table and it resets