Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 7 years ago
Edited 7 years ago
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.

0
I still need help please, anyone out here? JoeRaptor 72 — 7y

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

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
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) Perci1 4988 — 7y
0
Thanks, you're right :) Goulstem 8144 — 7y
0
I get Players.Player1.PlayerGui.WideScreen Bars and Lens Glare.Time and Score 2.OnesP:4: ')' expected near '.' as an output error. JoeRaptor 72 — 7y
0
I'm afraid that error doesn't occur inside the given code. Goulstem 8144 — 7y
View all comments (2 more)
0
@GoulStem you said to put color3.new(1,0,0), for c2 and base.ImageColor3 for c1 that was how the error haappened. JoeRaptor 72 — 7y
0
Show me how you're calling the function. Goulstem 8144 — 7y
Ad

Answer this question