What am i missing in this little piece of code

function TOOL:LeftClick( tr )
local Pos1 = GetEyeTrace( ).HitPos + GetEyeTrace( ).HitNormal
local Pos2 = GetEyeTrace( ).HitPos - GetEyeTrace( ).HitNormal
    util.Decal("Smile", Pos1, Pos2)

Thats the code. For a STool that spawns decals much like the paint STool. Are there any people out there that know whats wrong. Oh the error is it says GetEyeTrace is a nill value. So yeah thanks in advance!

Well the wiki has code that does this in it, jusgt put it in the tool function, this should work inside that function because i just tested it and it worked.
local Pos1 = tr.HitPos + tr.HitNormal
local Pos2 = tr.HitPos - tr.HitNormal
util.Decal(“Smile”, Pos1, Pos2)

Oh and you were calling GetEyeTrace() without self.Owner: infront, that was the problem.

Ok that made no sense, i meant the wiki code has an example in it which is basically what i said above.

Are you talking about the tool left click function or another one?

LeftClick function :stuck_out_tongue:

Yeah thanks all works well now


To Further on with this what folder would i place custom decals in? I saw a decal folder tried putting one in there but it didn’t work any help?


Grrr it’s annoying me. I got some decals from other maps and i put them in the decals folder and i even put it in the scripts folder in sandbox gamemode and it still doesn’t work!!! HELP please