Make healthtext yellow if less than 50

Hey, I was wondering how I can make my health text that displays the percentage of health left yellow if it gets below 50? I want it to be if it is above 50, then it’s green, but if it is below 50, it’s yellow. Can anyone help? Thanks.

You could make it go from green through to red as the health gets lower by doing something like this:
[lua]local col = Color((1 - health/maxhealth) * 255, health/maxhealth * 255, 0, 255)[/lua]


And setting the colour of the text to col obviously.

Thanks, but no thanks. I just want it to do what I said.

[lua]local col;
if LocalPlayer():Health() > 50 then
col = Color(0, 255, 0, 255);
col = Color(255, 255, 0, 255);

Then set the text colour to col.


Or on one line:
[lua]local col = LocalPlayer():Health()>50 and Color(0, 255, 0, 255) or Color(255, 255, 0, 255);[/lua]

Thank you so much. I am using it right now. Thank you!