Lua Error adding custom SWEP

Hey, I’ve been trying to add a custom SWEP to TTT and I’m getting this error.

[ERROR] lua/weapons/alpha/shared.lua:151: attempt to index global ‘umsg’ (a nil value)

  1. unknown - lua/weapons/alpha/shared.lua:151

[ERROR] lua/weapons/alpha/shared.lua:151: attempt to index global ‘umsg’ (a nil value)

  1. unknown - lua/weapons/alpha/shared.lua:151

Below is the lua

Any ideas?

Is it trying to run umsg functions on the client? Try putting it in a if( SERVER )

I tried that and you could no longer equip the weapon.

Replacing:


umsg.Start("JackysDynamicFGBobSwayScaling")
umsg.Entity(self)
umsg.Float(.5)
umsg.End()

with:


if( SERVER ) then
	umsg.Start("JackysDynamicFGBobSwayScaling")
	umsg.Entity(self)
	umsg.Float(.5)
	umsg.End()
end

At line 151 should not cause the code to break. The umsg functions are server-side, so they will create errors on the client.