Apply Trail to Trace Entity

[lua]
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end

local bullet = {} 
	bullet.Num = self.Primary.NumberofShots 
	bullet.Src = self.Owner:GetShootPos() 
	bullet.Dir = self.Owner:GetAimVector() 
	bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0) 
	bullet.Tracer = 0 
	bullet.Force = self.Primary.Force 
	bullet.Damage = self.Primary.Damage 
	bullet.AmmoType = self.Primary.Ammo 

local rnda = self.Primary.Recoil * -1 
local rndb = self.Primary.Recoil * math.random(-1, 1) 

self:ShootEffects() 

self.Owner:FireBullets( bullet ) 
self:EmitSound(Sound(self.Primary.Sound)) 
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) 
self:TakePrimaryAmmo(self.Primary.TakeAmmo) 

self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )

local pos = self.Owner:GetShootPos()
local ang = self.Owner:GetAimVector()
local tracedata = {}
tracedata.start = pos
tracedata.endpos = pos+(ang*5000)
tracedata.filter = self.Owner
local trace = util.TraceLine(tracedata)
if trace.HitNonWorld and trace.Entity:IsPlayer() then
	target = trace.Entity
	local trail = util.SpriteTrail(target, 0, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, "trails/plasma.vmt") --Line 93
end

end
[/lua]

Ok so thats my code now it works but i get the error



weapons\weapon_ttt_trailer\shared.lua:93: attempt to call field 'SpriteTrail' (a nil value)


EDIT Fixed it :smiley:
[lua]
if !SERVER then return end
local pos = self.Owner:GetShootPos()
local ang = self.Owner:GetAimVector()
local tracedata = {}
tracedata.start = pos
tracedata.endpos = pos+(ang*5000)
tracedata.filter = self.Owner
local trace = util.TraceLine(tracedata)
if trace.HitNonWorld and trace.Entity:IsPlayer() then
target = trace.Entity
local trail = util.SpriteTrail(target, 0, Color(255,0,0), false, 15, 1, 4, 1/(15+1)*0.5, “trails/plasma.vmt”)
end
[/lua]

for anyone who wants it