SWEP no longer calling SecondaryFire? What went wrong?

This is incredibly strange. I’m working on a SWEP and the Secondary Attack was working just fine until I started working on things today, just adding networked values. I didn’t even touch the SecondaryAttack section of my code. I’ve even commented out the code for my old secondary fire and replaced it with this:


function SWEP:SecondaryAttack()
	print("Is it working?")
end

Here’s a hint to the print: It’s not working. It doesn’t even get printed. There’s no error message and it loads just fine, printing out the reliable “[addon name] shared.lua loaded.” that I put at the end of all of my code. (The name of the file being changed of course.)

What could I possibly have done?

EDIT: Thought it’d be worth mentioning what I changed.

In the server autorun file:



local PlayerMeta = FindMetaTable("Player")
local EntityMeta = FindMetaTable("Entity")

function PlayerMeta:UpdateKarma()
	net.Start("SetCKarma")
		net.WriteFloat(self:GetKarma())
	net.Send(self)
end

function PlayerMeta:SetKarma(float)
	self:SetNWFloat("Addon.Karma",float)
end
function PlayerMeta:GetKarma()
	return self:GetNWFloat("Addon.Karma",50)
end
function PlayerMeta:AddKarma(float)
	self:SetNWFloat("Addon.Karma",self:GetKarma()+float)
	if self:GetKarma() < 0 then
		self:SetKarma(0)
	elseif self:GetKarma() > 100 then
		self:SetKarma(100)
	end
end

function EntityMeta:GetBestBone()
	for i,boneName in pairs(BestBones) do
		if self:LookupBone(boneName)~=nil then
			return self:LookupBone(boneName)
		end
	end
	
	return nil
end

function EntityMeta:GetBonePos(index)
	if index==nil then
		return nil
	else
		return self:GetBonePosition(index)
	end
end
 
function PlayerMeta:WouldSee(ent)
	local sp = self:GetShootPos()
	
	local targ = ent:GetBonePos(ent:GetBestBone())
	
	if targ==nil then targ = ent:GetPos() end
	if targ==nil then return false end
	
	local tr = util.QuickTrace(sp,(targ-sp),{self})

	return tr.Entity == ent 
end

function PlayerMeta:RandomBoolean(percent_chance)
	local compare = 100
	local luck = 50-self:GetKarma()
	local chance = percent_chance
	while (!((chance*10)%10==0)) do
		compare = compare * 10
		luck = luck * 10
		chance = chance * 10
	end
	local rand = math.random(0,compare)
	local rnjesus = rand-luck
	return chance >= rnjesus
end

function ValidCheck(ent)
	if ent~=nil then
		if ent~=NULL then
			if IsValid(ent) then
				if ent:IsValid() then
					return true
				else
					return false
				end
			else
				return false
			end
		else
			return false
		end
	else
		return false
	end
	return false
end

local function PlayerDeath(victim,inflictor,attacker)
	local weapon = nil
	if ValidCheck(inflictor) then
		weapon = inflictor:GetClass()
	end
	if weapon=="my_weapon" then
		attacker:AddKarma(0.5)
	else
		attacker:AddKarma(-1)
	end
	victim:AddKarma(-0.2)
end

hook.Add("PlayerDeath","Addon.PlayerDeath",PlayerDeath)


In the client autorun:



net.Receive( "SetCKarma", function()
	LocalPlayer():SetNWFloat("Addon.Karma",net.ReadFloat())
end )

function GetClientKarma()
	return LocalPlayer():GetNWFloat("Addon.ClientKarma",50)
end
function SetClientKarma(float)
	LocalPlayer():SetNWFloat("Addon.ClientKarma",float)
end


That’s it.

I found what happened. Somehow I managed to add a blank SecondaryAttack line. I don’t know how or why.

TL;DR, I’m a dumbass.