How to write the ActiveWeapon?

Hi, me agian, still making a gui. I was wondering how I could go about writing a current weapon.

I tried

ActiveWeapon = LocalPlayer():GetActiveWeapon()

and that just gave me this.

Weapon [81][weapon_physgun]

So is there anyway to do this? Thanks in advance! :slight_smile:

:GetClass() writes weapon_physgun,
ActiveWeapon = weapons.GetStored( LocalPlayer():GetActiveWeapon():GetClass() ).PrintName;

I copy pasted that code, I get a attempt to Index nil value err.

[ERROR] addons/mg's hud/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:119: attempt to index a nil value
  1. v - addons/mg's hud/lua/darkrp_modules/hudreplacement/cl_hudreplacement.lua:119
   2. unknown - lua/includes/modules/hook.lua:82

To me, it seems to work for every weapon except for physgun and gravity gun, so I guess you can use this, but it’s not a great solution:
ActiveWeapon = LocalPlayer():GetActiveWeapon():GetClass();
if ( !weapons.GetStored( ActiveWeapon ) ) then
weaponName = ActiveWeapon;
weaponName = weapons.GetStored( ActiveWeapon ).PrintName;


then weaponName is either weapon_physgun or for example .357 Magnum

Your beautiful. Thanks so much! SOLVED!