Fading Text according to distance

What I’m trying to do is as the player gets farther away or closer the text fades smoothly according to the distance. So the farther away the person is the harder it is to see the text, and the closer the easier it is. How would I do something like that?

You mean like Nexus’s /addtext function?
(Or something like that)

[lua]local distance = EyePos():Distance( targetPos );
local alpha = math.Clamp( 255 - distance / maxDist * 255, 0, 255 );[/lua]

That’s how to calculate the alpha based on distance.

Thanks man