My code is:
[lua] draw.DrawText(ply:GetPData(“cs_title”, “Newbie”), “DarkRPHUD2”, pos.x + 1, pos.y + 61, Color(0, 0, 0, 255), 1) [/lua]
If I run this from console, it prints out all the titles (the pdata) of the connected players, which means that PData is infact not nil like the error claims.
[lua] for k, v in pairs(player.GetAll()) do
I have a PlayerInitialSpawn hook which basically outputs the PData (and it works, so yeah) and if it’s not set for the current player, sets it to “Newbie” so in no way it can actually be nil.
Error that it gives me:
[lua] [ERROR] lua/includes/modules/draw.lua:147: bad argument #1 to ‘len’ (string expected, got nil)
The code is put inside the default darkrp hud.lua, so ply is defined.