Retriving DarkRP players money in HUD?

Hey!
I have been working on a HUD in Dark RP but at the moment it gives an error to any player that joins the server:



local function DrawInfo()
[ERROR] gamemodes/darkrp/gamemode/client/hud.lua:110: attempt to concatenate field 'money' (a nil value)
  1. DrawInfo - gamemodes/darkrp/gamemode/client/hud.lua:110
   2. DrawHUD - gamemodes/darkrp/gamemode/client/hud.lua:257
    3. unknown - gamemodes/darkrp/gamemode/client/hud.lua:357



This is the code in DrawInfo()
[lua]
local Salary = DarkRP.getPhrase(“salary”, GAMEMODE.Config.currency, (localplayer:getDarkRPVar(“salary”) or 0))
localplayer = LocalPlayer()
local JobWallet = {
DarkRP.getPhrase(“job”, localplayer:getDarkRPVar(“job”) or “”), "
",
DarkRP.getPhrase(“wallet”, GAMEMODE.Config.currency, formatNumber(localplayer:getDarkRPVar(“money”) or 0))
}
JobWallet = table.concat(JobWallet)

local wep = localplayer:GetActiveWeapon()

if IsValid(wep) and GAMEMODE.Config.weaponhud then
    local name = wep:GetPrintName();
	draw.DrawText(DarkRP.getPhrase("weapon", name), "UiBold", RelativeX + 5, RelativeY - HUDHeight - 18, Color(255, 255, 255, 255), 0)
end
draw.DrawText("$".. (LocalPlayer().DarkRPVars.money) or 0, "DarkRPHUD2", RelativeX + 110, RelativeY - HUDHeight + 10, ConVars.salary1, 0)
draw.DrawText("$".. (LocalPlayer().DarkRPVars.money) or 0, "DarkRPHUD2", RelativeX + 110, RelativeY - HUDHeight + 10, ConVars.salary2, 0)

local w, h = surface.GetTextSize(Salary)

draw.DrawText("$"..JobWallet, "DarkRPHUD2", RelativeX + 110, RelativeY - HUDHeight + h + 19, ConVars.Job1, 0) 
draw.DrawText("$"..JobWallet, "DarkRPHUD2", RelativeX + 110, RelativeY - HUDHeight + h + 19, ConVars.Job2, 0)

end
[/lua]
What I really want is the values of the salary and wallet along with the job name without the “Job:”, “Salary:”, “Money:” bits. I just want the numbers and nothing else. Help!

Why can’t you just look at the code of the default HUD?

If LocalPlayer is nil, which it is when you join, DarkRPVars will be nil and an attempt to get money from DarkRPVars will fail. You should use getDarkRPVar(thevar) for all the player vars, and not just job.

Solved it in the end by using gsub like so:
[lua]
JobWallet:gsub(‘Wallet:’, ‘’)
[/lua]
Did that so I could just have the values rather than the descriptions.