@Richtofen-legacy (Richtofen) posted a new topic, subject "Attempt to index local 'player' (A Nil Value) [Help!]". It read:

   So I have made a rounded box that has the player(s) avatar, name, and ping. Now im trying to make it print the player(s) rank. I am using ULX and ULIB, while coding this I have come across an error that I don't really understand.
    [code] 
        if self.player:IsUserGroup("owner") then
        		self.rank = self:Add("DLabel")
        		self.rank:SetFont("ScoreboardTiny")
        		self.rank:Dock(FILL)
        		self.rank:DockMargin(5,5,5,5)
        		self.rank:SizeToContents()
        		self.rank:SetTextColor( Color(255, 255, 255, 255))
        	end
        
        
    [/code]
    
    I don't understand because I used this coding almost word for word to draw this:
    
    Which draws a different color box when a user is a certain group… The colored box coding looks very similar:
    [code] 
        function PANEL:Paint(w, h)
        	//draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 225) ) --Individual Player Tags
        	if self.player:IsUserGroup("owner") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(0, 0, 0, 200) )	
        	elseif self.player:IsUserGroup("superadmin") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(240, 45, 45, 200) )
        	elseif self.player:IsUserGroup("admin") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(45, 123, 240, 200) )
        	elseif self.player:IsUserGroup("moderator") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(45, 240, 84, 200) )
        	elseif self.player:IsUserGroup("vip")then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(240, 201, 45, 200) )
        	elseif self.player:IsUserGroup("user") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 200) )
        	end
        end
        
        
    [/code]
    
    If anyone could help me with this, that would be great!
    
    If you need any further code from this file I will post it!
    
    Don't remember if I included this but this is a scoreboard.

So @KarmaLord-legacy (KarmaLord) replied

    Give the entire error and the entire lua file the code is caused from

@Richtofen-legacy (Richtofen) replied

    [code]
        function PANEL:Init()
        	self:SetSize(ScrW() * 0.44, ScrH() * 0.78)
        	self:Center()
        
        	self.body = self:Add("DPanel")
        	self.body:Dock(FILL)
        	self.body:DockMargin(5, 5, 5, 5)
        
        	self.body.Paint = function(body, w, h)
        		draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 20) )
        	end
        
        	self.header = self.body:Add("DPanel")
        	self.header:Dock(TOP)
        	self.header:SetTall(self:GetTall() * 0.15)
        	self.header:DockMargin(4, 4, 4, 4)
        
        	self.footer = self.body:Add("DPanel")
        	self.footer:Dock(BOTTOM)
        	self.footer:SetTall(38)
        	self.footer:DockMargin(4, 4, 4, 4)
        
        	self.header.Paint = function(header, w, h)
        		draw.RoundedBox( 4, 0, 0, w, h, Color(37, 85, 132, 200) )
        	end
        
        	self.header.title = self.header:Add("DLabel")
        	self.header.title:SetText("SubZero Deathrun")
        	self.header.title:SetFont("ScoreboardBig")
        	self.header.title:SetContentAlignment(5)
        	self.header.title:Dock(FILL)
        
        	self.header.hostName = self.header:Add("DLabel")
        	self.header.hostName:SetText( "A Small Gmod Community" )
        	self.header.hostName:SetFont("ScoreboardSmall")
        	self.header.hostName:SetContentAlignment(5)
        	self.header.hostName:DockMargin(3, 3, 3, 5)
        	self.header.hostName:Dock(BOTTOM)
        
        	self.footer.Paint = function(footer, w, h)
        		draw.RoundedBox( 4, 0, 0,w ,h, Color(37, 85, 132, 200) )
        	end
        
        	self.footer.spectators = self.footer:Add("DLabel")
        	self.footer.spectators:SetText( "SPECTATORS :" )
        	self.footer.spectators:SetFont("ScoreboardSmall")
        	self.footer.spectators:DockMargin(5, 5, 5, 5)
        	self.footer.spectators:Dock(FILL)
        
        	self.run = self.body:Add("ScoreboardTeam")
        	self.run:SetWide( (self:GetWide() * 0.5) - 15 )
        	self.run:DockMargin(5, 5, 5, 5)
        	self.run:Dock(LEFT)
        	self.run:SetTeam(TEAM_RUNNER)
        
        	self.death = self.body:Add("ScoreboardTeam")
        	self.death:SetWide( (self:GetWide() * 0.5) - 15 )
        	self.death:DockMargin(5, 5, 5, 5)
        	self.death:Dock(RIGHT)
        	self.death:SetTeam(TEAM_DEATH)
        end
        
        function PANEL:Paint(w, h)
        	draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 100) ) --BackPanel For Scoreboard (Behind Everything)
        end
        
        vgui.Register("Scoreboard", PANEL, "DPanel")
        
        local PANEL = {}
        
        function PANEL:Init()
        	self.title = self:Add("DLabel")
        	self.title:Dock(TOP)
        	self.title:DockMargin(5, 5, 5, 5)
        	self.title:SetFont("ScoreboardMedium")
        	self.title:SetText("N/A")
        	self.title:SizeToContents()
        
        	self.scroll = self:Add("DScrollPanel")
        	self.scroll:Dock(FILL)
        	self.scroll:DockMargin(5, 5, 5, 5)
        
        	self.scroll.Paint = function(scroll, w, h)
        		draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 200) ) ---Behind Individual Player Tags
        	end
        end
        
        function PANEL:SetTeam(index)
        	self.team = index
        	self.title:SetTextColor( team.GetColor(index) )
        end
        
        function PANEL:Think()
        	if (self.team) then
        		local players = team.NumPlayers(self.team)
        		local name = team.GetName(self.team)
        
        		if (players == 1) then
        			suffix = " Player"
        		end
        
        		self.title:SetText(name)
        		if self.team == TEAM_RUNNER then
        			self.title:SetText("RUNNERS")
        			self.title:SetTextColor( Color(255, 255, 255, 255) )
        			self.title:SetContentAlignment(5)
        		elseif self.team == TEAM_DEATH then
        			self.title:SetText("DEATH")
        			self.title:SetTextColor( Color(255, 255, 255, 255) )
        			self.title:SetContentAlignment(5)
        		end
        
        		for k, v in SortedPairs( player.GetAll() ) do
        			if (!IsValid(v.ts_Row) and v:Team() == self.team) then
        				local row = self.scroll:Add("ScoreboardPlayer")
        				row:Dock(TOP)
        				row:DockMargin(3, 3, 3, 0)
        				row:SetPlayer(v)
        
        				v.ts_Row = row
        
        				self.scroll:AddItem(row)
        			end
        		end
        	end
        end
        
        function PANEL:Paint(w, h)
        	draw.RoundedBox( 2, 0, 0, w, h, Color(37, 85, 132, 200) )
        end
        
        vgui.Register("ScoreboardTeam", PANEL, "DPanel")
        
        
        
        local PANEL = {}
        
        function PANEL:Init()
        	self:SetTall(36)
        
        	if self.player:IsUserGroup("owner") then
        		self.rank = self:Add("DLabel")
        		self.rank:SetFont("ScoreboardTiny")
        		self.rank:Dock(FILL)
        		self.rank:DockMargin(5,5,5,5)
        		self.rank:SizeToContents()
        		self.rank:SetTextColor( Color(255, 255, 255, 255))
        	end
        	
        
        	self.avatar = self:Add("AvatarImage")
        	self.avatar:Dock(LEFT)
        	self.avatar:DockMargin(3, 3, 3, 3)
        	self.avatar:SetSize(32, 32)
        
        	self.avatar.click = self.avatar:Add("DButton")
        	self.avatar.click:Dock(FILL)
        	self.avatar.click:SetText("")
        
        	self.avatar.click.Paint = function() end
        
        	self.avatar.click.DoClick = function(avatarButton)
        		local menu = DermaMenu()
        
        		menu:AddOption("View Profile", function()
        			if ( IsValid(self.player) ) then
        				self.player:ShowProfile()
        			end
        		end)
        
        		local text = "Mute"
        
        		if (self.player.ts_Muted) then
        			text = "Unmute"
        		end
        		
        		menu:AddOption(text, function()
        			if ( IsValid(self.player) ) then
        				self.player.ts_Muted = !self.player.ts_Muted
        				self.player:SetMuted(self.player.ts_Muted)
        			end
        		end)
        
        		menu:Open()
        	end
        
        	self.name = self:Add("DLabel")
        	self.name:SetFont("ScoreboardSmall")
        	self.name:SetText("N/A")
        	self.name:Dock(LEFT)
        	self.name:DockMargin(5, 5, 5, 5)
        	self.name:SizeToContents()
        	self.name:SetTextColor( Color(255, 255, 255, 255) )
        
        	self.ping = self:Add("DLabel")
        	self.ping:SetFont("ScoreboardMedium")
        	self.ping:SetText("")
        	self.ping:DockMargin(5, 5, 5, 5)
        	self.ping:Dock(RIGHT)	
        	self.ping:SizeToContents()
        end
        
        function PANEL:SetPlayer(client)
        	if ( IsValid(client) ) then
        		self.player = client
        		self.team = client:Team()
        		self.avatar:SetPlayer(client)
        		self.initialized = true
        	end
        end
        
        function PANEL:Think()
        	if ( self.initialized and !IsValid(self.player) ) then
        		self:Remove()
        	elseif (self.initialized) then
        		if ( self.team != self.player:Team() ) then
        			self:Remove()
        		end
        
        		local amount = math.Clamp(self.player:Ping() / 200, 0, 1)
        
        		self.ping:SetTextColor( Color( (255 * amount), 255 - (255 * amount), (1 - amount) * 75, 200) )
        		self.ping:SetText( self.player:Ping() )
        		self.ping:SizeToContents()
        
        		if ( self.player:Name() != self.name:GetText() ) then
        			self.name:SetText( self.player:Name() )
        			self.name:SizeToContents()
        		end
        	end
        end
        
        function PANEL:Paint(w, h)
        	//draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 225) ) --Individual Player Tags
        	if self.player:IsUserGroup("owner") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(0, 0, 0, 200) )	
        	elseif self.player:IsUserGroup("superadmin") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(240, 45, 45, 200) )
        	elseif self.player:IsUserGroup("admin") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(45, 123, 240, 200) )
        	elseif self.player:IsUserGroup("moderator") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(45, 240, 84, 200) )
        	elseif self.player:IsUserGroup("vip")then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(240, 201, 45, 200) )
        	elseif self.player:IsUserGroup("user") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 200) )
        	end
        end
        
        
    [/code]

After which, @KarmaLord-legacy (KarmaLord) added

    Either thats the wrong file or not the entirety of the code.

To which @Richtofen-legacy (Richtofen) replied

    KarmaLord:
    
    > Either thats the wrong file or not the entirety of the code.
    
    You don't need the entire code the rest is just scoreboard properties. I just need to know why its saying ‘player' responding nil value

Then @KarmaLord-legacy (KarmaLord) said

    Richtofen:
    
    > You don't need the entire code the rest is just scoreboard properties. I just need to know why its saying ‘player' responding nil value
    
    I actually do so that the line numbers are proper. Otherwise:

After which, @Richtofen-legacy (Richtofen) added

    KarmaLord:
    
    > I actually do so that the line numbers are proper. Otherwise:
    > 
    > http://puu.sh/3ltX7.png
    [code] 
        
        local PANEL = {}
        
        surface.CreateFont("ScoreboardBig", {
        	size = ScreenScale(25),
        	weight = 800,
        	antialias = true,
        	font = "Harabara",
        	outline = true
        } )
        
        surface.CreateFont("ScoreboardMedium", {
        	size = ScreenScale(12),
        	weight = 600,
        	antialias = true,
        	font = "Harabara",
        	outline = true
        } )
        
        surface.CreateFont("ScoreboardSmall", {
        	size = ScreenScale(10),
        	weight = 600,
        	antialias = false,
        	font = "Harabara",
        	outline = true
        } )
        
        surface.CreateFont("ScoreboardTiny", {
        	size = ScreenScale(8),
        	weight = 200,
        	antialias = true,
        	font = "Harabara",
        } )
        
        
        function PANEL:Init()
        	self:SetSize(ScrW() * 0.44, ScrH() * 0.78)
        	self:Center()
        
        	self.body = self:Add("DPanel")
        	self.body:Dock(FILL)
        	self.body:DockMargin(5, 5, 5, 5)
        
        	self.body.Paint = function(body, w, h)
        		draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 20) )
        	end
        
        	self.header = self.body:Add("DPanel")
        	self.header:Dock(TOP)
        	self.header:SetTall(self:GetTall() * 0.15)
        	self.header:DockMargin(4, 4, 4, 4)
        
        	self.footer = self.body:Add("DPanel")
        	self.footer:Dock(BOTTOM)
        	self.footer:SetTall(38)
        	self.footer:DockMargin(4, 4, 4, 4)
        
        	self.header.Paint = function(header, w, h)
        		draw.RoundedBox( 4, 0, 0, w, h, Color(37, 85, 132, 200) )
        	end
        
        	self.header.title = self.header:Add("DLabel")
        	self.header.title:SetText("SubZero Deathrun")
        	self.header.title:SetFont("ScoreboardBig")
        	self.header.title:SetContentAlignment(5)
        	self.header.title:Dock(FILL)
        
        	self.header.hostName = self.header:Add("DLabel")
        	self.header.hostName:SetText( "A Small Gmod Community" )
        	self.header.hostName:SetFont("ScoreboardSmall")
        	self.header.hostName:SetContentAlignment(5)
        	self.header.hostName:DockMargin(3, 3, 3, 5)
        	self.header.hostName:Dock(BOTTOM)
        
        	self.footer.Paint = function(footer, w, h)
        		draw.RoundedBox( 4, 0, 0,w ,h, Color(37, 85, 132, 200) )
        	end
        	self.footer.spectators = self.footer:Add("DLabel")
        	self.footer.spectators:SetText( "SPECTATORS :" )
        	self.footer.spectators:SetFont("ScoreboardSmall")
        	self.footer.spectators:DockMargin(5, 5, 5, 5)
        	self.footer.spectators:Dock(FILL)
        
        	self.run = self.body:Add("ScoreboardTeam")
        	self.run:SetWide( (self:GetWide() * 0.5) - 15 )
        	self.run:DockMargin(5, 5, 5, 5)
        	self.run:Dock(LEFT)
        	self.run:SetTeam(TEAM_RUNNER)
        
        	self.death = self.body:Add("ScoreboardTeam")
        	self.death:SetWide( (self:GetWide() * 0.5) - 15 )
        	self.death:DockMargin(5, 5, 5, 5)
        	self.death:Dock(RIGHT)
        	self.death:SetTeam(TEAM_DEATH)
        end
        
        function PANEL:Paint(w, h)
        	draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 100) ) --BackPanel For Scoreboard (Behind Everything)
        end
        
        vgui.Register("Scoreboard", PANEL, "DPanel")
        
        local PANEL = {}
        
        function PANEL:Init()
        	self.title = self:Add("DLabel")
        	self.title:Dock(TOP)
        	self.title:DockMargin(5, 5, 5, 5)
        	self.title:SetFont("ScoreboardMedium")
        	self.title:SetText("N/A")
        	self.title:SizeToContents()
        
        	self.scroll = self:Add("DScrollPanel")
        	self.scroll:Dock(FILL)
        	self.scroll:DockMargin(5, 5, 5, 5)
        
        	self.scroll.Paint = function(scroll, w, h)
        		draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 200) ) ---Behind Individual Player Tags
        	end
        end
        
        function PANEL:SetTeam(index)
        	self.team = index
        	self.title:SetTextColor( team.GetColor(index) )
        end
        
        function PANEL:Think()
        	if (self.team) then
        		local players = team.NumPlayers(self.team)
        		local name = team.GetName(self.team)
        
        		if (players == 1) then
        			suffix = " Player"
        		end
        
        		self.title:SetText(name)
        		if self.team == TEAM_RUNNER then
        			self.title:SetText("RUNNERS")
        			self.title:SetTextColor( Color(255, 255, 255, 255) )
        			self.title:SetContentAlignment(5)
        		elseif self.team == TEAM_DEATH then
        			self.title:SetText("DEATH")
        			self.title:SetTextColor( Color(255, 255, 255, 255) )
        			self.title:SetContentAlignment(5)
        		end
        
        		for k, v in SortedPairs( player.GetAll() ) do
        			if (!IsValid(v.ts_Row) and v:Team() == self.team) then
        				local row = self.scroll:Add("ScoreboardPlayer")
        				row:Dock(TOP)
        				row:DockMargin(3, 3, 3, 0)
        				row:SetPlayer(v)
        
        				v.ts_Row = row
        
        				self.scroll:AddItem(row)
        			end
        		end
        	end
        end
        
        function PANEL:Paint(w, h)
        	draw.RoundedBox( 2, 0, 0, w, h, Color(37, 85, 132, 200) )
        end
        
        vgui.Register("ScoreboardTeam", PANEL, "DPanel")
        
        
        
        local PANEL = {}
        
        function PANEL:Init()
        	self:SetTall(36)
        
        	/*if self.player:IsUserGroup("owner") then
        		self.rank = self:Add("DLabel")
        		self.rank:SetFont("ScoreboardTiny")
        		self.rank:Dock(FILL)
        		self.rank:DockMargin(5,5,5,5)
        		self.rank:SizeToContents()
        		self.rank:SetTextColor( Color(255, 255, 255, 255))
        	end
        	*/
        
        	self.avatar = self:Add("AvatarImage")
        	self.avatar:Dock(LEFT)
        	self.avatar:DockMargin(3, 3, 3, 3)
        	self.avatar:SetSize(32, 32)
        
        	self.avatar.click = self.avatar:Add("DButton")
        	self.avatar.click:Dock(FILL)
        	self.avatar.click:SetText("")
        
        	self.avatar.click.Paint = function() end
        
        	self.avatar.click.DoClick = function(avatarButton)
        		local menu = DermaMenu()
        
        		menu:AddOption("View Profile", function()
        			if ( IsValid(self.player) ) then
        				self.player:ShowProfile()
        			end
        		end)
        
        		local text = "Mute"
        
        		if (self.player.ts_Muted) then
        			text = "Unmute"
        		end
        		
        		menu:AddOption(text, function()
        			if ( IsValid(self.player) ) then
        				self.player.ts_Muted = !self.player.ts_Muted
        				self.player:SetMuted(self.player.ts_Muted)
        			end
        		end)
        
        		menu:Open()
        	end
        
        	self.name = self:Add("DLabel")
        	self.name:SetFont("ScoreboardSmall")
        	self.name:SetText("N/A")
        	self.name:Dock(LEFT)
        	self.name:DockMargin(5, 5, 5, 5)
        	self.name:SizeToContents()
        	self.name:SetTextColor( Color(255, 255, 255, 255) )
        
        	self.ping = self:Add("DLabel")
        	self.ping:SetFont("ScoreboardMedium")
        	self.ping:SetText("")
        	self.ping:DockMargin(5, 5, 5, 5)
        	self.ping:Dock(RIGHT)	
        	self.ping:SizeToContents()
        end
        
        function PANEL:SetPlayer(client)
        	if ( IsValid(client) ) then
        		self.player = client
        		self.team = client:Team()
        		self.avatar:SetPlayer(client)
        		self.initialized = true
        	end
        end
        
        function PANEL:Think()
        	if ( self.initialized and !IsValid(self.player) ) then
        		self:Remove()
        	elseif (self.initialized) then
        		if ( self.team != self.player:Team() ) then
        			self:Remove()
        		end
        
        		local amount = math.Clamp(self.player:Ping() / 200, 0, 1)
        
        		self.ping:SetTextColor( Color( (255 * amount), 220 - (255 * amount), (1 - amount) * 75, 200) )
        		self.ping:SetText( self.player:Ping() )
        		self.ping:SizeToContents()
        
        		if ( self.player:Name() != self.name:GetText() ) then
        			self.name:SetText( self.player:Name() )
        			self.name:SizeToContents()
        		end
        	end
        end
        
        function PANEL:Paint(w, h)
        	//draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 225) ) --Individual Player Tags
        	if self.player:IsUserGroup("owner") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(0, 0, 0, 200) )	
        	elseif self.player:IsUserGroup("superadmin") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(240, 45, 45, 200) )
        	elseif self.player:IsUserGroup("admin") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(45, 123, 240, 200) )
        	elseif self.player:IsUserGroup("moderator") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(45, 240, 84, 200) )
        	elseif self.player:IsUserGroup("vip")then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(240, 201, 45, 200) )
        	elseif self.player:IsUserGroup("user") then
        		draw.RoundedBox( 4, 0, 0, w, h, Color(255, 255, 255, 200) )
        	end
        end
        
        vgui.Register("ScoreboardPlayer", PANEL, "DPanel")
        
        local SCOREBOARD
        
        function GM:ScoreboardShow()
        	gui.EnableScreenClicker(true)
        
        	SCOREBOARD = vgui.Create("Scoreboard")
        end
        
        function GM:ScoreboardHide()
        	gui.EnableScreenClicker(false)
        	
        	if not SCOREBOARD then return end
        
        	SCOREBOARD:Remove()
        end
        
        
        
    [/code]

To which @KarmaLord-legacy (KarmaLord) replied

    Is it me or is that code littered with stuff that looks like it shouldnt be there?
    
    Ex:
    [code] 
        self.title:SetFont(="keyword operator">="string">"ScoreboardMedium")
        
        
    [/code]
    
    =“keyword operator”>=“string”>

Then @Richtofen-legacy (Richtofen) said

    KarmaLord:
    
    > Is it me or is that code littered with stuff that looks like it shouldnt be there?
    > 
    > Ex:
    [code] 
    >     self.title:SetFont(="keyword operator">="string">"ScoreboardMedium")
    >     
    >     
    [/code]
    > 
    > =“keyword operator”>=“string”>
    
    I think facepunch is changing something, because I don't have that in my file… either that or it copied weird.
    
    Here is apastebin


{'source': 'discourse', 'url': 'https://forum.facepunch.com/t/attempt-to-index-local-player-a-nil-value-help/127892', 'title': "Attempt to index local 'player' (A Nil Value) [Help!]", 'views': 979, 'has_accepted_answer': False, 'word_count': 2610, 'like_count': 0, 'reply_count': 8, 'participant_count': 2, 'posts': 9, 'tags': '', 'author': '@Richtofen-legacy (Richtofen)', 'participants': '@Richtofen-legacy (Richtofen), @KarmaLord-legacy (KarmaLord)', 'image_url': ['https://aws1.discourse-cdn.com/business20/uploads/facepunch1/original/3X/f/b/fba2708623afa5449ad7d71b91ebe94c7be0a8ee.png'], 'created_at': '2013-06-22T08:15:26.000Z', 'last_posted_at': '2013-06-22T08:49:43.000Z'}