Scoreboard


local function scoreBoard()
	local scrw = ScrW()
	local scrh = ScrH()
	local w = 1000
	local h = 500
	
	draw.RoundedBox(0, (scrw / 2) - (w / 2), (scrh / 2) - (h / 2), w, h, Color(0, 0, 0, 255))
end

function GAMEMODE:HUDDrawScoreBoard()
	scoreBoard()
end

What am I doing wrong? When I execute the script it just draws black on my screen without me even opening the scoreboard.

GM:ScoreboardHide()

Example:


SB = {}

surface.CreateFont("ServerName", {
	font = "Marlett",
	size = 80,
	weight = 400,
})

surface.CreateFont("scoreinfo", {
	font = "Bebas",
	size = 24,
	weight = 0,
})

SB.back = nil
SB.headercolor = Color(255,2,2,25)
SB.playerspacing = 0



function GM:ScoreboardShow()
   gui.EnableScreenClicker(false)
	SB.back = vgui.Create("DFrame")
//	SB.back:MakePopup()
	SB.back:SetSize(600, 600)
	SB.back:SetPos(ScrW()/2-(SB.back:GetWide()/2),1)
	SB.back:ShowCloseButton(false)
	SB.back:SetTitle("")
	SB.back.Paint = function(self)
		surface.SetDrawColor(Color(0,2,25,0))
		surface.SetMaterial( Material( "gui/gradient" ) ) -- You can change this material to anything you want. 
		surface.DrawTexturedRect(0,0,self:GetWide(),self:GetTall())
		
	end
	local header = vgui.Create("DLabel", SB.back)
	header:SetText(" ") -- Replace " " with the name of your server!
	header:SetColor(Color(204,102,0)) -- This is the color of which the text above the scoreboard will be.
	header:SetFont("ServerName")
	header:SizeToContents()
	header:SetPos((SB.back:GetWide()-header:GetWide())/2,5)
	
	local dpanellist = vgui.Create("DPanelList", SB.back)
	dpanellist:SetSize(SB.back:GetWide()-10, SB.back:GetTall()-100)
	dpanellist:SetPos(5,75)
//	dpanellist:SetSpacing(0)
	for _,v in pairs(player.GetAll()) do
		local dpanel = vgui.Create("DPanel")
		dpanel:SetSize(dpanellist:GetWide(),36)
		dpanel.Paint = function(self)
			surface.SetDrawColor(Color(105,105,105,145))
			surface.SetMaterial( Material( "vgui/white" ) ) -- You can change this material to anything you want.
			surface.DrawTexturedRect(0,0,self:GetWide(),self:GetTall()-15)
		end
		
		
		local avatar = vgui.Create("AvatarImage",dpanel)
		avatar:SetPlayer(v,32)
		avatar:SetSize(16,16)
		avatar:SetPos(2,2)
		
		local name = vgui.Create("DLabel",dpanel)
		name:SetText(v:Name())
		name:SetColor(Color(172,172,172))
		name:SetFont("scoreinfo")
		name:SetPos(30, -2)
		name:SizeToContents()
		
	
		
		
		
		dpanellist:AddItem(dpanel)
		
		
	end
end
function GM:ScoreboardHide()
	if SB.back then
		SB.back:Close()
		SB.back = nil
	end
	return false
end