Like Seerah said, UnitHealth("unit") function does not return the percentage, but returns current health of the unit.
Your code would still work and even view-able on low levels, but it gets harder to recognize as the damage and health values get huge on higher levels.
Thus, you will have to do something like this:
Code:
function(progress, r1, g1, b1, a1, r2, g2, b2, a2)
local health, healthMax = UnitHealth("player"), UnitHealthMax("player");
local percentage = health / healthMax * 100;
local red, green, blue = 0, 0, 0;
if percentage > 60 then
red, green, blue = 0, 1, 0;
elseif percentage > 20 then
red, green, blue = 0, 1, 1;
else
red, green, blue = 1, 0, 0;
end
return red, green, blue, 1;
end
Hope this helps