Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make something gradually go to a certain color?

I am trying to make a part gradually go from its set color to the color red (255,0,0). How would I do this? I'm asking for a formula.

1 comment

0

You don't need a formula, use TweenService.

1 answer

✓ Accepted answer

Use this script, it will slowly fade the color into the new color(This is how health bars change color btw)

Tested Script(100% works)

local Part = nil --Set the part here
local TimePeriod = 10 -- Set how long it takes to finish the color shift

local Color1 = Color3.fromRGB(255,0,0) -- Color you want to change to

local Color2 = Part.Color

for i = 1,100,1 do
      wait(TimePeriod/100)
       Part.Color = Color2:lerp(Color1,(i/100))
end

2 comments

0

Thanks, I appreciate it.

0

Np Man

This discussion is preserved as it was. New answers, comments, and votes are closed.