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

Ok, if I want the color to change to red what do I do??

local speed = 0.05
local base = script.Parent 

function transition(c2,c1)  --c2 is new, c1 is old.
    for i = 0,1,speed do
        base.ImageColor3 = c1:lerp(c2,i);
        wait(.05)
    end
    base.ImageColor3 = c2
end

I finishing color is red.

1 comment

0

I still need help please, anyone out here?

1 answer

You can use the lerp function on color3 values.

local speed = 0.05
local base = script.Parent 

function transition(c2,c1)  --c2 is new, c1 is old.
	for i = 0,1,speed do
		base.ImageColor3 = c1:lerp(c2,i);
		wait(.05)
	end
	base.ImageColor3 = c2
end

6 comments

1

1 / i would, for example, be 1 / 0.05, which is 20. Lerp requires a number between 0 and 1, since it's basically a percent in decimal form. So you can just do c1:lerp(c2, i)

0

Thanks, you're right :)

0

I get Players.Player1.PlayerGui.WideScreen Bars and Lens Glare.Time and Score 2.OnesP:4: ')' expected near '.' as an output error.

0

I'm afraid that error doesn't occur inside the given code.

0

@GoulStem you said to put color3.new(1,0,0), for c2 and base.ImageColor3 for c1 that was how the error haappened.

0

Show me how you're calling the function.

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