Attempt to index global "self" (A nil value)

Hey guys. Getting errors with a lightsaber plugin a recently installed onto my server. I get the error msg
[Error] lua/weapons/weapon_lightsaber.lua:42: attempt to index global “self” (A nil value)
1. unknown - lua/weapons/weapon_lightsaber.lua:42

This only happens when I add this code :
self:SetMaxLength( 42 )
self:SetCrystalColor( Vector( 255, 0, 0 ) )
self:SetDarkInner( false )
self:SetWorldModel( “models/sgg/starwars/weapons/w_anakin_ep2_saber_hilt.mdl” )
self:SetBladeWidth( 2 )

self.LoopSound = “sound/lightsaber/saberloop1.wav”
self.SwingSound = “sound/lightsaber/saberswing1.wav”
self:SetOnSound( “sound/lightsaber/saberon1.wav” )
self:SetOffSound( “sound/lightsaber/saberoff1.wav” )

self.WeaponSynched = true

This code makes the lightsaber set default to all those settings (Or so I was told by the creator of the mod) Im pretty sure this code is in the right place, the creator said “You must call these functions on the weapon right after spawning it, where self is the weapon”

Need to fix this, the reason I need this code is because the lightsaber is invisible in game. Any help will be appreciated. :smiley:

That code is in the deploy function, right?

Fixed now! Thanks!