Im trying to draw a 3d2d text, made on the client, when an entity touches the current entity im trying to draw it on. This is the code. the error it gives is: Tried to use a NULL entity! also I did add the network string but its not shown in the code.
function ENT:Think()
if self.isCooking == true then
self:SetColor(Color(255,0,0))
else
self:SetColor(Color(0,255,0))
end
if self.isCooking == true then
if self.finishCooking <= CurTime() then
self.isCooking = false
net.Start("statusclosed")
net.Send(ply)
local morphine = ents.Create("morphine")
morphine:SetPos(self:GetPos() + Vector(0,0,50))
morphine:Spawn()
end
end
end
net.Receive("statusclosed",function (ply)
local posss = self:GetPos()
local angsss = self:GetAngles()
local offsetss = angsss:Up() + angsss:Forward() * 15 + angsss:Right() * 0 ;
angsss:RotateAroundAxis(self:GetAngles():Up(),90)
angsss:RotateAroundAxis(self:GetAngles():Right(),-90)
angsss:RotateAroundAxis(self:GetAngles():Forward(),360)
local distss = self:GetPos():Distance(EyePos())
local clamss = math.Clamp(distss, 0, 255 )
local mainss = (255 - clamss)
if (mainss <= 0) then return end
cam.Start3D2D(posss+offsetss,angsss,0.13)
draw.WordBox(0,-55,-40,"Empty","NewFontsz",Color(0,0,0,main),Color(180,10,0,main))
cam.End3D2D()
end)