• Custom scoreboard error
    9 replies, posted
I keep trying to make a scoreboard, because I am trying to learn how to. I know how to get the basic setup but when I make the base of the scoreboard and go in game and press tab it just says nothing. It says I am “trying to index “GM” a nil value” i used exactly what was on the wiki but just added my derma panel. i changed the GM to GAMEMODE and that does get rid of the error but then when I press tab in game nothing shows up. plz help
Without showing us your code he cannot do anything
This is the file structure... folder/lua/autorun/scoreboard.lua I used this code in order to make my scoreboard: scoreboard = scoreboard or {} function scoreboard:show()  local ScoreBoardDerma = vgui.Create("DFrame")  ScoreBoardDerma:SetSize(750,500)  ScoreBoardDerma:SetPos(ScrW()/2-325, ScrH()/2-250)  ScoreBoardDerma:SetTitle("Custom Scoreboard")  ScoreBoardDerma:SetDraggable(false)  ScoreBoardDerma:ShowCloseButton(false)  ScoreBoardDerma.Paint = function()   draw.RoundedBox(5,0,0,ScoreBoardDerma:GetWide(), ScoreBoardDerma:GetTall(), Color(60,60,60,255))  end  local AppList = vgui.Create( "DListView", ScoreBoardDerma )  AppList:Dock( FILL )  AppList:SetMultiSelect( false )  AppList:AddColumn( "Players" )  AppList:AddColumn( "Kills" )  function scoreboard:hide()   -- This is where you hide the scoreboard, such as with Base:Remove()  end   --[[ Line painting ]]--  for _, v in pairs ( player.GetAll() ) do   local line = playerlist:AddLine( v:Name(), v:Frags(), v:Deaths(), v:Ping() )   function line:Paint( w, h )       --Paint the LINEs here   end  end  --[[ Column header painting ]]--  for _, v in pairs( playerlist.Columns ) do   function v.Header:Paint( w, h )       -- Paint the HEADERs here      end   v.Header:SetTextColor( Color( 255, 255, 255, 0 ) ) -- Set its text alpha with this in case you paint the text manually  end end function ScoreboardShow()  scoreboard:show() end function ScoreboardHide()  scoreboard:hide() end
In the first line, the variable scoreboard..do you let it refer to itself and if not being a table??
If I am going to be completely honest, I do not know. I just used it from the wiki as a template and that was in the little example, I got it from here: Basic scoreboard creation
does no one know?
GM/ScoreboardShow use this hook and inside that hook do some Category to create a scoreboard
So I should use this inside a hook?
luanooob Thank fucking god. Yes you should put it in that hook, kinda like exactly what Trackster said.
GM/ScoreboardShow use this hook and inside that hook do some Category to create a scoreboard Thats EXACLY what i said...
Sorry, you need to Log In to post a reply to this thread.