What's A Better Way Then Looping Through All Of The Keys?

This script makes a key and adds it to the dataStore along with the player’s ID

local DataStore = game:GetService("DataStoreService")
local Classes = DataStore:GetDataStore("1234")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game.Players:GetPlayers()

-- Creating a class
local function createCode(Player, code)
	local code = code
	
	members = Classes:GetAsync(code)--Check if the code is already in use
	if not members then
		Classes:SetAsync(code, {Owner = Player.UserId, Members = {}})
		print("There are no members")
		return true
	else
		--Tell the user the code is taken, class codes must be unique
		return false
	end
end

What’s the best way to make a gui that shows all of the keys the player is in when the player rejoins.
The only option I can think of is looping through all of the keys and checking if the player is indexed in one of them, but that would reach the datastore limits. What are you thoughts?

Hello, Play_MazeOfHeck!

You can set a table for a players userid as the key.

ex:

local DataStore = game:GetService("DataStoreService")
--You would obviously check for the table if said table exists and add upon that.
DataStore:SetAsync(player.UserId, {"Code1", "Code2"})
--here is where you would set the codes value i.e Classes:SetAsync(code, {Owner = Player.UserId, Members = {}})