I am so confused

WHY THE HELL WON’T THIS SPRITE DRAW
and yes I already checked to make sure the think function is running, everything is running but I see NOTHING

[lua]
function SWEP:Think()
if(CLIENT)then
local lolmat2 = Material(“sprites/redglow1.vmt”)
local tr = util.QuickTrace( self.Owner:GetShootPos(), self.Owner:GetAimVector()*99999, self.Owner )
if(self:GetNetworkedBool(“LaserOn”))then
render.SetMaterial( lolmat2 )
render.DrawSprite( tr.HitPos, 20, 20, Color(255,255,255,255))
end
end
end
[/lua]

You need to drawing in a drawing hook, not a think hook.

Does ViewModelDrawn() count? Because that’s where I was doing this, and it wasn’t working, so I moved to think.

**[SWEP.DrawHUD

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=SWEP.DrawHUD)**

[lua] if CLIENT then
local lolmat2 = Material(“sprites/redglow1.vmt”)
function SWEP:ViewModelDrawn()
local tr = util.QuickTrace( self.Owner:GetShootPos(), self.Owner:GetAimVector()*99999, self.Owner )
if(self:GetNetworkedBool(“LaserOn”))then
render.SetMaterial( lolmat2 )
render.DrawSprite( tr.HitPos, 20, 20, Color(255,255,255,255))
end
end
end
[/lua]

Calling Material() in a hook is very bad, you shouldn’t do it. Ever.
You should also use **[Entity.DTVar

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Entity.DTVar)** instead of Networked stuff. They’re much faster updating, they work much better and are generally better optimized.
You should also check if LaserOn is true.

Oh, I got it figured out.

The place where the code was in the ViewModelDrawn() function was apparently beyond some kind of met “if blah then return end” type conditional. It’s clavus’ swep construction kit code, so I really don’t understand it. Lol.