0

# Color Lerp doesn't work properly?

local newColor = Color3.new(math.random(255), math.random(255), math.random(255))
for i=0,1,0.1 do
script.Parent.Color = script.Parent.Color:lerp(newColor, i)
wait()
end


0
replace wait() with wait(.01) F_F 53 — 2y
0
im confused as to what do you want it to do? are you complaining about the fact that it is doing it really fastly or do you want it to go from color to color without passing multiple different colors? if the latter, use tweens, not lerp, and do Color3.fromRGB, because Color3 takes values from 0 to 1. radusavin366 617 — 2y
0
@F_F That won't do anything, @radusavin I already figured it out, but thanks for your help, the problem is that i used color3.new instead of Color3.fromRGB, habit from other game engine. and using lerp is much simpler than tweens Azure_Kite 870 — 2y

0
Edited 2 years ago

Color3.new takes float from 0 to 1. You should use Color3.fromRGB instead if you're trying to use RGB values for parameters:

local newColor = Color3.fromRGB(math.random(255), math.random(255), math.random(255))
for i=0,1,0.1 do
script.Parent.Color = script.Parent.Color:lerp(newColor, i)
wait()
end


https://wiki.roblox.com/index.php?title=API:Color3