SWep not firing?

I’ve made a SWep, note this is my first SWep so I don’t really know what I’m doing. When I fire it makes a clicking sound and doesn’t seem to do the script I put in SWEP:PrimaryAttack()

lua/weapons/Bugspray/shared.lua
[lua]
SWEP.Author = “CowThing”
SWEP.Contact = “”
SWEP.Purpose = “Kill pesky bugs”
SWEP.Instructions = “Aim at a creppy crawly and squirt it”

SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.ViewModel = “models/weapons/v_grenade.mdl”
SWEP.WorldModel = “models/weapons/w_grename.mdl”

SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “none”

SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = true
SWEP.Secondary.Ammo = “none”

local FireSound = CreateSound(self.Weapon, “ambient/gas/steam_loop01.wav”)

function SWEP:PrimaryAttack()

if CLIENT then return end

local ply = self:GetOwner()
local Cone = ents.FindInCone(ply:GetShootPos(), ply:GetAimVector(), 36, 24)

for _,npc in ipairs(Cone) do
	
	if npc:IsNPC() then
		
		npc:TakeDamage(1,ply,self.Weapon)
		
	end
	
end

end

function SWEP:SecondaryAttack()

end[/lua]

I don’t plan on having a secondary attack but the reason I put a blank SWEP:SecondaryAttack() is because it fired like a shotgun, am I somehow using a base of another SWep?

Don’t worry about the shotgun thing, it’s a silly addition garry made for when there is no secondary attack. As for your primary attack, does FindInCone still work? I’ve heard that sometimes it doesn’t do what it should. Try setting your primary clipsize to 1 and the default clip to 1.

Oh I found out what was wrong,
[lua]local FireSound = CreateSound(self.Weapon, “ambient/gas/steam_loop01.wav”)[/lua]
gave me an error, I guess self.Weapon doesn’t exist there. So I removed it for now and it all seemed to work right.

I do have another question though, whats the best way to make a bar that depletes when firing and regenerate when not firing?

You mean the drawing of it? Take a look at the surface and draw libraries.

No I mean the actual back end counting.

[editline]02:33PM[/editline]

Hmm I guess FindInCone doesn’t work right, no matter what radius I put it still kills 180 degrees in front of me.