But the colors don’t red-shift like I want them to. (they go all over the place)
I’m not too good with HSV’s and stuff.
local CurrentH
for i,p in pairs(Chains) do
if p then
local h, s, v = Color3.toHSV(p.Color) --// Main bits I want you guys to focus on
p.Color = Color3.fromHSV(h, 75/TotalDamage, 75/TotalDamage)
end
end
for i,p in pairs(Bricks) do
if p then
local h, s, v = Color3.toHSV(p.Color) --// Main bits i want you guys to focus on
p.Color = Color3.fromHSV(h, 75/TotalDamage, 75/TotalDamage)
CurrentH = h
end
end
pcall(function()
local HitParticle = script.HitP:Clone()
HitParticle.Parent = Root
HitParticle.Color = ColorSequence.new(Color3.fromHSV(CurrentH or 1, TotalDamage/75, TotalDamage/75)) --// Main bits i want you guys to focus on
HitParticle:Emit(1)
Debris:AddItem(HitParticle,HitParticle.Lifetime.Max)
end)
HSV stands for Hue, Saturation, Value, which is probably ideal for shifting colors around rainbow. However, you are using an unspecific color to begin with, which means you’ll have to either:
Use TweenService and tween the value to the red color to some extent.
Use linear interpolation to shift it into somewhat red-ish color.
Some color-based techniques to shift the color to red. It’s more or less complicated.
Then what do you do if the red value is maximum and the other values are just lower? Technically works only for all values that red isn’t higher than others.
p.Color = Color3.fromRGB(255, 255, 0):Lerp(Color3.fromRGB(255, 0, 0),TotalDamage/MaxDamage)
Seems to work if i use Lerp! if i divide the current damage with the maximum cap, then it returns a decimal value below 1, which is perfect for lerping!