Best hook to drawing SimpleText with a player object

Hello, I am “VERY” new to lua coding and I am not familiar with any hooks for drawing a SimpleText function with a player object. My code is below:


function spawnStuff( ply )
	draw.SimpleText( "Hello "..ply:Nick().."! Welcome to my server!", "Default", 1, 1, Color( 50, 50, 50 ) )
end
hook.Add( "HUDPaint", "SpawnStuff", spawnStuff )

Note that I tried HUDPaint and it doesn’t pass the player object into the function. What would be a good hook for doing so?

HUDPaint will work perfectly. Don’t use ply though, as it isn’t an argument for HUDPaint. Use LocalPlayer() instead of ply.

So just to be clear, would it look like this?


function spawnStuff()
	draw.SimpleText( "Hello "..LocalPlayer().."! Welcome to my server!", "Default", 1, 1, Color( 50, 50, 50 ) )
end
hook.Add( "HUDPaint", "SpawnStuff", spawnStuff )

ply is mostly used to refer to the Player Object.
Clientside, you can use LocalPlayer() as the client Player Object.
So out of ply:Nick() would be LocalPlayer():Nick()

Its working now! Thanks for the help guys :smile: