I am creating a DarkRP server with the latest version of Garry's Mod. I am attempting to enable and use the default jobs on the server, but I get this error in the client console whenever I press F4:

[DarkRP] gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:23: attempt to index local 'jobTable' (a nil value)
  1. Call - gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:23
   2. unknown - gamemodes/darkrp/gamemode/modules/base/cl_gamemode_functions.lua:62

This is the cl_gamemode_functions.lua file:

local GUIToggled = false
local mouseX, mouseY = ScrW() / 2, ScrH() / 2
function GM:ShowSpare1()
    local jobTable = LocalPlayer():getJobTable()

    if jobTable.ShowSpare1 then
        return jobTable.ShowSpare1(LocalPlayer())

    GUIToggled = not GUIToggled

    if GUIToggled then
        gui.SetMousePos(mouseX, mouseY)
        mouseX, mouseY = gui.MousePos()

function GM:ShowSpare2()
    local jobTable = LocalPlayer():getJobTable()

    if jobTable.ShowSpare2 then
        return jobTable.ShowSpare2(LocalPlayer())


function GM:PlayerStartVoice(ply)
    if ply == LocalPlayer() then
        ply.DRPIsTalking = true
        return -- Not the original rectangle for yourself! ugh!
    self.Sandbox.PlayerStartVoice(self, ply)

function GM:PlayerEndVoice(ply)
    if ply == LocalPlayer() then
        ply.DRPIsTalking = false

    self.Sandbox.PlayerEndVoice(self, ply)

function GM:OnPlayerChat()

local FKeyBinds = {
    ["gm_showhelp"] = "ShowHelp",
    ["gm_showteam"] = "ShowTeam",
    ["gm_showspare1"] = "ShowSpare1",
    ["gm_showspare2"] = "ShowSpare2"

function GM:PlayerBindPress(ply, bind, pressed)
    self.Sandbox.PlayerBindPress(self, ply, bind, pressed)

    local bnd = string.match(string.lower(bind), "gm_[a-z]+[12]?")
    if bnd and FKeyBinds[bnd] then
        hook.Call(FKeyBinds[bnd], GAMEMODE)

    if not self.Config.deadvoice and not ply:Alive() and string.find(string.lower(bind), "voicerecord") then return true end

function GM:InitPostEntity()
    hook.Call("teamChanged", GAMEMODE, GAMEMODE.DefaultTeam, GAMEMODE.DefaultTeam)

function GM:teamChanged(before, after)

local function OnChangedTeam(um)
    local oldTeam, newTeam = um:ReadShort(), um:ReadShort()
    hook.Call("teamChanged", GAMEMODE, oldTeam, newTeam) -- backwards compatibility
    hook.Call("OnPlayerChangedTeam", GAMEMODE, LocalPlayer(), oldTeam, newTeam)
usermessage.Hook("OnChangedTeam", OnChangedTeam)

timer.Simple(0, function() GAMEMODE.ShowTeam = DarkRP.openKeysMenu end)
  • Can you post the original code? Or the lines that the error is referring to? Commented Aug 22, 2016 at 21:41
  • @BritishFerret I am assuming this is the file in question.
    – JAL
    Commented Aug 22, 2016 at 21:42
  • @JAL That is the file. Commented Aug 23, 2016 at 1:31
  • I attached the code in the cl_gamemode_functions.lua file. Commented Aug 23, 2016 at 1:36

1 Answer 1


These questions assume you are using the codebase at FPtje/DarkRP.

A few ideas.

  • You have a corrupt jobTable database. (Source)
  • You are trying to load the game mode in single player. (Same source as above)
  • You are trying to modify the cl_gamemode_functions.lua file directly without using an addon like darkrpmodification. (Source)
  • You created or joined an invalid team. (Source)
  • You are trying to call a gamemode function that before the gamemode has finished setting up. (Source)
  • I don't know if I have a corrupt jobTable database, I am launching into the server from the browser (not legacy), I am usign darkrpmodification, I cannot join a team to begin with and thrown into Joining/Connection, and I have not modified the file so I do not know if that code is messing it up (I attached the code in cl_gamemode_functions.lua above). Commented Aug 23, 2016 at 1:38
  • You also don't have to supply sources everytime. Commented Aug 23, 2016 at 13:33
  • @CamouflagedCow I provided the links to open issues on GitHub because I thought they would help. Have you thought about opening your own issue on the repo?
    – JAL
    Commented Aug 23, 2016 at 13:34
  • I managed to fix my issue. Since you seem to have knowledge on server hosting, I am still having other errors unrelated to my question. Players keep spawning in walls and they cannot use weapons or see the HUD to select one. Commented Aug 28, 2016 at 18:56
  • @CamouflagedCow maybe ask a new question? I'm not sure what could be wrong.
    – JAL
    Commented Aug 28, 2016 at 20:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .