First time making custom viewbobbing so Im pretty bad at it but I dont know whats wrong
function SWEP:CalcView(ply, pos, ang, fov)
if LocalPlayer():InVehicle() then return end
local view = {}
if IsValid(LocalPlayer():GetActiveWeapon()) && LocalPlayer():GetActiveWeapon():GetClass() != 'gmod_tool' then
pos = pos + Vector( 0, 0, math.cos(CurTime() *20))
angles = angles + Angle(0,0,math.cos(CurTime())*0.15)
end
view.origin = pos
view.angles = angles
view.fov = fov
return view
end
hook.Add("CalcView", "ViewShake", calcView)
This is the error
**[ERROR] addons/my base v1/lua/weapons/ghost_base/shared.lua:307: bad argument #1 to ‘__add’ (Angle expected, got nil)
- __add - [C]:-1
- func - addons/my base v1/lua/weapons/ghost_base/shared.lua:307
3. unknown - gamemodes/base/gamemode/cl_init.lua:380**