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

Why does Color3:lerp() return nil?

for i = 1, 100, .01 do
	wait()
script.Parent.BackgroundColor3 = Color3:lerp(30, 41, 255, 1)
end

Whenever I play the game, it says "attempt to call method 'lerp' (a nil value)"

Help is appreciated, thanks :D

1 answer

It is returning nil due to the fact you are calling it to Color3. You should call it on it after you construct it with the constructor. If you are using .new you should do r / 255 g / 255 b / 255 since it receives decimal values however with .fromRGB you can use your current values

script.Parent.BackgroundColor3 = script.Parent.BackgroundColor3:lerp(Color3.new(30/255, 41/ 255, 255/255), i / 100) -- I'm pretty sure this is what you want to do

or with .fromRGB

script.Parent.BackgroundColor3 = script.Parent.BackgroundColor3:lerp(Color3.fromRGB(30, 41, 255), i / 100)

1 comment

0

Reading this over it seems so bad but whatever

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