HelpNoRecoil Lua Help?

Posts 16–18 of 18 · Page 2 of 2
[ERROR] lua/recoil.lua:9: attempt to index field 'Primary' (a nil value)
1. fn - lua/recoil.lua:9
2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

Getting this error with mikus "Fix"

When ever I take out my physicgun
Quote Originally Posted by BigBadWilly View Post
[ERROR] lua/recoil.lua:9: attempt to index field 'Primary' (a nil value)
1. fn - lua/recoil.lua:9
2. unknown - addons/ulib/lua/ulib/shared/hook.lua:183

Getting this error with mikus "Fix"

When ever I take out my physicgun
Send me you're code.
You might need to add a check around the code like
if LocalPlayer():GetActiveWeapon():Primary then

end
Or something like that.
I had this problem as well and that's how I fixed it.
Quote Originally Posted by Trollaux View Post


Send me you're code.
You might need to add a check around the code like
if LocalPlayer():GetActiveWeapon():Primary then

end
Or something like that.
I had this problem as well and that's how I fixed it.
hook.Add("Think","Work Bitch",function()

local wep = LocalPlayer():GetActiveWeapon()

if wep.Recoil != 0 then
wep.OldRecoil = wep.Recoil
wep.Recoil = 0
end
if wep.Primary.Recoil != 0 then
wep.Primary.OldRecoil = wep.Primary.Recoil
wep.Primary.Recoil = 0
end
if wep.Secondary.Recoil != 0 then
wep.Secondary.OldRecoil = wep.Secondary.Recoil
wep.Secondary.Recoil = 0
end

end)
Posts 16–18 of 18 · Page 2 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us