2D3D NPCtext not drawing?

Why isn’t this 2D3D NPCtext drawing? I’ve check the code multiple times and it looks alright, also it doesn’t output any lua errors to console. :confused:


surface.CreateFont("npctext_large", {
		font = "Tahoma",
		size = 100,
		weight = 600,
		antialias = true
	})
	
surface.SetFont("npctext_large")
local w,h = surface.GetTextSize("Shop")
local function Draw(self)
	self:DrawModel()
	
	local p = self:GetPos() + Vector(0,0,100 + math.sin(CurTime()*3)*5)
	
	for _,yaw in pairs({0, 180}) do
	
		local a = Angle(0, 0, 0)
		a:RotateAroundAxis(a:Forward(), 90)
		a:RotateAroundAxis(a:Right(), yaw)
		a:RotateAroundAxis(a:Right(), CurTime()*15)
		
		render.PushFilterMag(TEXFILTER.ANISOTROPIC)
		render.PushFilterMin(TEXFILTER.ANISOTROPIC)
		cam.Start3D2D(p, a, 0.3)
			draw.DrawText("Car Dealer", "npctext_large", 0, 0, Color(200, 200, 200, 255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
		cam.End3D2D()
		render.PopFilterMag()
		render.PopFilterMin()
	end
end

usermessage.Hook("donpcshoprender", function(um)
	local ent = um:ReadEntity()
	if not IsValid(ent) then return end
	
	ent.RenderOverride = Draw
	
	local min,max = ent:GetRenderBounds()
	max = max + Vector(0,0,60)
	ent:SetRenderBounds(min, max)
end


you’re not hooking the Draw function you made to anything

Could you please give an example? Can’t quite get what you’re saying. c:

hook.Add

To be honest, hooks were a confusing concept to me when I started out. It might take a while to understand how they work, but it’s basically like this:
Every time an event happens, the engine calls a hook. For example, every time a player spawns, the hook

GM/PlayerSpawn gets called.
If you want to do something every time a player spawns, you would use

hook.Add to add your function to this hook. That way, your function will be called every time the hook is called.

The hook you’re looking for is probably

GM/HUDPaint.

If you don’t get it (I’m not a great teacher), look around for some guides! I’m sure Acecool has a guide for hooks somewhere, but you’ll have to ask him…