DarkRP - PlayerName size changes if name is too long?

Hi… I’m in the process of making a HUD and i’m having a little problem i can’t seem to solve. I need to make it so when a players name is over 17 the font changes size.
Here is what i have tried so far but it doesn’t work.



surface.CreateFont( "healthf", {
 font = "Bebas Neue",
 size = 16,
 weight = 500,
 blursize = 0,
 scanlines = 0,
 antialias = true
} )

surface.CreateFont( "name", {
 font = "Bebas Neue",
 size = 36,
 weight = 500,
 blursize = 0,
 scanlines = 0,
 antialias = true
} )

surface.CreateFont( "job", {
 font = "Bebas Neue",
 size = 18,
 weight = 500,
 blursize = 0,
 scanlines = 0,
 antialias = true
} )


local font
	
	surface.SetFont( "name" )
	local PlayerName = LocalPlayer():Name()
	local Width, Height = surface.GetTextSize(PlayerName)
	if Width > 16 then
		font = "healthf"
	else
		font = "name"
	end
  
  draw.DrawText( " "..PlayerName, "name", 315, ScrH() - 40, Color(255, 255, 255, 255))


Thanks in advance.

You didnt call font…

change “name” to font



surface.CreateFont( "name", {
 font = "Bebas Neue",
 size = 36,
 weight = 500,
 blursize = 0,
 scanlines = 0,
 antialias = true
} )


name is a font i’m using

I think he means change
[lua]draw.DrawText( " "…PlayerName, “name”, 315, ScrH() - 40, Color(255, 255, 255, 255))[/lua]
to
[lua]draw.DrawText( " "…PlayerName, font, 315, ScrH() - 40, Color(255, 255, 255, 255))[/lua]

Oh xD… Thanks.