How to define max health??

Hey guys I am back and having yet another issue with my DarkRP hud… Here MaxHealth is not defined for some reason, but it’s a normal darkrp var. Can anyone help me define or or point me where I can? All help is appreciated, and thank you for reading!


 if(lastHealth != LocalPlayer():Health()) then
        local d = math.Clamp( LocalPlayer():Health(), 0, 100 ) / (LocalPlayer().MaxHealth)
        lastHealth = Lerp(FrameTime(), lastHealth, d * 305)
red.w = math.Clamp( LocalPlayer().MaxHealth, 0, 100 )

    end


LUA ERROR:

[ERROR] addons/darkrpmodification-master/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:107: attempt to perform arithmetic on field ‘MaxHealth’ (a nil value)

  1. fn - addons/darkrpmodification-master/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:107
  2. unknown - addons/ulib/lua/ulib/shared/hook.lua:179

:GetMaxHealth()

Fantastic works, but now I have to refresh the files for the HUD to show. After I refresh the files and it shows this error pops up:

[ERROR] lua/includes/util/color.lua:16: bad argument #1 to ‘min’ (number expected, got nil)

  1. min - [C]:-1
  2. Color - lua/includes/util/color.lua:16
    3. unknown - gamemodes/darkrp/gamemode/modules/hungermod/cl_init.lua:48

Timer Failed! [Simple][@gamemodes/darkrp/gamemode/modules/hungermod/cl_init.lua (line 53)]