Problem with Table

So currently I have a table with ULX groups in it, and the player’s bar on the scoreboard will flash if they are in one of the usergroups in the table. (This works)
I’m trying to get so that when a player is in a usergroup that is not in the table, it will stay one color. (40,40,40,255)

I’ve looked over the Wiki to see if I can figure out a solution but its obvious the problem is right in front of me and i’m just not seeing it, I’d appreciate any help even if the issue doesn’t get resolved. Don’t shit post either, please.

Error: attempt to index a nil value

Table


xScoreStaffRanks = {
	["superadmin"] = { StaffColor = Color(0, 149, 255, 255) },
	["admin"] = { StaffColor = Color(0, 255, 0, 255) },
}


**
Code Snippet that is Affected**


	for k, v in ipairs(Players) do
		local bg = vgui.Create("DPanel", self.PanelList)
		bg:SetSize(self:GetWide()-10, 32)
		bg:SetPos(5,5)
		bg.Paint = function(w,h)
		local StaffColor = xScoreStaffRanks[v:GetUserGroup()].StaffColor
			local Flash = math.abs(math.sin(CurTime() * 2))
			if xScoreStaffRanks[v:GetUserGroup()] == nil then
				surface.SetDrawColor(40,40,40,255)
			end
			surface.SetDrawColor(Color(StaffColor.r * Flash, StaffColor.g * Flash, StaffColor.b * Flash, StaffColor.a))
			surface.DrawRect(0,0,bg:GetWide(),bg:GetTall())
		end

Change the table to:


xScoreStaffRanks = {
	["superadmin"] = Color(0, 149, 255, 255),
	["admin"] = Color(0, 255, 0, 255)
}

Then do


local cStaff = xScoreStaffRanks[v:GetUserGroup()]

if (cStaff == nil) then
	-- Do regular colours here
else
	-- Do flashing colours here
end

How would I continue doing the flashing colors when I have the flashing colors set up like this?:



surface.SetDrawColor(Color(StaffColor.r * Flash, StaffColor.g * Flash, StaffColor.b * Flash, StaffColor.a))

-EDIT-
Nevermind, all works! Thanks for the help!