What is the most efficient/easiest way to allow players to customize their own weapon loadouts in a gamemode?

I am trying to make a class menu for a game where players can choose whatever weapon they want. The data needs to be saved so that players will not need to constantly remake the class every time they join. They class also needs to only show what they have unlocked.

I have made a xp system already and it records the rank from .

It saves the players rank this way:


Here is the way I was thinking of accomplishing it:


local rankwep = {}
rankwep[2] = “m4a1”
rankwep[4] = “mp5”
rankwep[5] = “m1014”
rankwep[6] = “acr”
rankwep[8] = “sr25”
rankwep[9] = “model444”
rankwep[11] = “m60”
rankwep[12] = “m16a2”
rankwep[13] = “ar57”
rankwep[15] = “tar-21”
rankwep[16] = “s12”
rankwep[18] = “m98”
rankwep[19] = “m92fs”
rankwep[20] = “aug”
rankwep[21] = “m14”
rankwep[23] = “scar-h”
rankwep[24] = “deagle”
rankwep[26] = “pdw”
rankwep[27] = “val”
rankwep[28] = “g2”
rankwep[30] = “p90”

//Here is the area within the cl_init file where the player selects what guns they want to pick

class1:SetParent( base )
class1:SetSize( 150, 50 )
class1.Paint = function()
draw.RoundedBox( 2, 0, 0, base:GetWide()+40, base:GetTall()+40, Color(80,0,0,180))
class1.DoClick = function()
DComboBox:SetParent( base )
DComboBox:SetPos( (base:GetWide()/2)-(base:GetWide()/8), (base:GetTall()/2)-(base:GetTall()/4) )
DComboBox:SetSize( 100, 20 )
DComboBox:SetValue( “options” )

//Now it retrieves the rank of the player and goes down the to 0. If the value it checks is nil it will not add the value to the selection.

			local rankcountdown = rank

while rankcountdown != 0 and rankcountdown != nil do
	if rankwep[rankcountdown] != nil then
		DComboBox:AddChoice( rankwep[rankcountdown] )
	rankcountdown = rankcountdown - 1


I can think of a one way to do it, but it will be extremely tedious and will probably end up being inefficient in the long run.

Thanks in advance.