How to make screen flash yellow when damaged

i need to make screen flash yellow when player is damaged, and it should appear for amount of time depends of how much damage player get in one hit (the more damage, the more effect lasts on screen)

using colorcorrection and tweenservice

have a maximum time and damage and a minimum time and damage

then you can get the amount of time it should last to by seeing how close the damage is to the maximum damage, which will give you a percent to maximum time

without a minimum, that calculation is simple. just damage / maxDamage = percent to max time

with a minimum you will have to a little bit more math
(damage - minDamage) / (maxDamage - minDamage) = percent to max time
(this is slope formula if you are wondering)

then just use that time value to make the tween on the color correction object last that much time