SetCurrentWeaponProficiency() Not working

[lua]function SWEP:Initialize()
if ( SERVER ) then
self:SetWeaponHoldType( self.HoldType )

WTF When I spawn this in an npc, theres an error and it says that setcurrentweaponproficiency is a nil value…

I think you should use self.Owner:SetCurrentWeaponProficiency(WEAPON_PROFICIENCY_PERFECT) for it to work on the npc not the weapon.

Same error:
pcweaponsv2\lua\weapons\weapon_lr300\shared.lua:75: attempt to call method ‘SetCurrentWeaponProficiency’ (a nil value)

Should I use if Owner.IsNPC then self.Owner:Set…?

self.Owner:IsNPC() and yes i suppose so, are you testing this on npcs or yourself

Edit, the code you posted has line 75 in it right?

Oui. Its basically a swep coded just for npc usage.


Under what should I put it in? Initialize, Think, or PrimaryAttack?

if self.Owner:IsNPC() then


I dont really make sweps but it surely isnt PrimaryAttack or Think, btw you have a space in PROF ICIENCY

Well Think would be excecuted every frame. I think that may be inefficient. I shall go with Initialize.


Omfg it still says it s nil value. Wtf is wrong with gmod.