Particle Emitter Problem.

Hello, I am fooling around with particleEmitters to try to create a realistic smoke effect. the effect is done, and it indeed does work, But whenever i pause the game or go into console, i get

[addons\chainsaw\lua\weapons\weapon_zs_chainsaw\cl_init.lua:29] ParticleEmitter: Couldn't make emitter! Too many emitters!
[addons\chainsaw\lua\weapons\weapon_zs_chainsaw\cl_init.lua:32] attempt to index field 'emitter' (a nil value)

Here is my code for creating the particles:
local smoke = {

function SWEP:Think()
self.emitter = ParticleEmitter(self:GetPos())
local BoneIndx = self.Owner:LookupBone(“ValveBiped.Bip01_R_Hand”)
local position = self.Owner:GetBonePosition( BoneIndx )
local particle = self.emitter:Add( table.Random(smoke), position)
if self.Weapon:IsValid() then
particle:SetDieTime( 1 )
particle:SetStartAlpha( 10 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 0 )
particle:SetEndSize( math.Rand( 20, 30 ) )
particle:SetRoll( math.Rand( 360, 480 ) )
particle:SetRollDelta( math.Rand( -1, 1 ) )
particle:SetColor( 180, 180, 180 )
EDIT: i think i might have found the problem. the server builds up ALL THESE emitters while the game is paused/stopped.
i tested this, and there was a larger puff of smoke after resuming the game. the puff was larger and more opaque the longer i had it paused.
So, here’s the next question. How would i opress the think function creating emitters while the game is paused?

[lua]function SWEP:Initialize()
self.emitter = ParticleEmitter(self:GetPos())

function SWEP:Think()
– particle stuff

You don’t need to make a new emitter every frame, and that is what is causing your first error of “too many emitters.” This, in turn, causes the second error, because it refuses to create the emitter since there are too many, and then you try to work off it.

This should fix your problem. :buddy:

-snip- wouldn’t work