MemoryStoreHashMap:SetAsync keeps returning False

Hello, currently I am using a HashMap from MemoryStoreService to store lobbies across multiple different servers for a party system. I am using a unique HashMap for every type of dungeon their is (4 currently) and I’m running into the problem of SetAsync always returning false.

From how the documentation describes it, SetAsync returns either true or false, with false indicating that it was unable to set or override an entry. This however has not occurred before, and if it was unable to set a value, an error would be thrown saying that I encountered a rate limit issue or something similar. I am wondering if I am running into some sort of hidden limitation or my implementation is wrong.

This is new behavior, and is really derailing development.

To be clear, this is the way I am using MemoryStore HashMap:

function PartyService:CreateParty(player: Player, partySettings: {})
    local partyTable = {
        host = player.UserId,
        players = { player.UserId },
        name = partySettings.Name or player.DisplayName .. "'s Party",
        partyType = partySettings.PartyType,
        mapSelected = partySettings.MapSelected,
        difficulty = partySettings.Difficulty,
        maxCount = partySettings.MaxCount,
        joinRequests = {},
        ready = false
    }
    
    if partySettings.PartyType == "Solo" then
        self.Parties[player] = partyTable
        
        return partyTable
    end
    
    player:SetAttribute("DungeonType", partyTable.mapSelected)
    
    local setSuccess, setError = pcall(function()
        return self.PartyManifest[partySettings.MapSelected].Hashmap:SetAsync(player.UserId, partyTable, 3600)
    end)
    
    print(setSuccess, setError)
    
    return partyTable, player.UserId
end

I’ve verified that the tables in self.PartyManifest do exist and contain the appropriate information, and the print() outputs true, false.

If there is a better implementation of Cross-Server parties, or if there is something I am missing from SetAsync, some guidance would be very appreciated.

1 Like

You did nothing wrong. The same occurs for SetSortedAsync, so it isn’t an issue on your end and I was able to replicate your findings easily. Although I don’t know what the boolean even means for either function, since I could not find any documentation for either, can you send where you found it. It may not mean success, and if you want it to be treated as such you can just use setSuccess to determine whether the call was successful. Either way, seems to be a bug.

local sortedMap = game:GetService("MemoryStoreService"):GetSortedMap("Hello")
print(sortedMap:SetAsync(1, {string.rep("a", 10)}, 10)) -- Used to print true in 12/2024, but now prints false
print(sortedMap:GetAsync(1)) -- It DOES set

local hashMap = game:GetService("MemoryStoreService"):GetHashMap("Hello")
print(hashMap:SetAsync(1, {string.rep("a", 10)}, 10)) -- Used to print true in 12/2024, but now prints false
print(hashMap:GetAsync(1)) -- It DOES set

Interesting. I wrapped it in a pcall as I was wondering if it was just how I was doing it. Originally, I had no pcall.

I was grasping at straws at that point. But yeah, it’s very strange that the function just returns false, even if it was set. I verified it was by just printing the output.

	local setSuccess, setError = pcall(function()
		return self.PartyManifest[partySettings.MapSelected].Hashmap:SetAsync(player.UserId, partyTable, 3600)
	end)
	
	print(self.PartyManifest[partySettings.MapSelected].Hashmap:GetAsync(player.UserId))

It is very strange that it just returns false though. The issue I am running into now is that I cannot fetch the same value I set later on. Will update this post with more information.

Alright. Figured out the bug on my end. Was an issue with my code.

However, GetAsync returning false when the operation did complete is very strange and probably not intended behavior.

There is no documentation on this and the example Roblox provides is ehhh. Very misleading.