Hello, I’m garbage when it comes to code but I would like some help please. I have a custom weapon base and that, on some random occasions, will spam the console with the bug below when picking up a gun (in TTT). It can be fixed by dropping and picking up the weapon but still, it’s a bug. Your gun also becomes invisible when this error occurs.
I believe it is because self.Owner comes up nil and I am not sure how exactly I would fix it. Here are the bug(s), thanks
[ERROR] addons/sleek ttt base/lua/weapons/swb_base/cl_model.lua:198: attempt to call method 'GetViewModel' (a nil value) 1. unknown - addons/sleek ttt base/lua/weapons/swb_base/cl_model.lua:198 [ERROR] addons/sleek ttt base/lua/weapons/swb_base/cl_hud.lua:89: attempt to call method 'ShouldDrawLocalPlayer' (a nil value) 1. unknown - addons/sleek ttt base/lua/weapons/swb_base/cl_hud.lua:89
The line of code in cl_model at line 198:
vm = self.Owner:GetViewModel()
And here is line 89 of cl_hud
lp = self.Owner:ShouldDrawLocalPlayer()
I should also mention that it doesn’t happen mid round, usually right after they spawn. Possibly suggesting it is because they haven’t finished loading yet?
Thanks a ton in advance!