Fading Colors

I am trying to make text go from green to red depending on the players health. I would like to be able to edit the starting color and ending color. I think you would use math.clamp but I havn’t really messed with it in the way I am wanting to do something.

100%
( 0, 208, 0, 255 )
1%
( 208, 0, 0, 255 )

Like this?


local hp = LocalPlayer():Health()
local color = Color( 208 - hp / 100 * 208, hp / 100 * 208, 0 )

Order of operations :byodood:

Seems to check out with BIDMAS.

Does Lua use BIDMAS or just go from left to right?

it does indeed use BIDMAS 'ol chap.