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

Is there an easier way I can write this transition?

Asked by
c5or 8
6 years ago
while wait() do
    logo.ImageColor3 = Color3.new(0.1, 0.1, 0.1)
        wait()
    logo.ImageColor3 = Color3.new(0.2, 0.2, 0.2)
        wait()
    logo.ImageColor3 = Color3.new(0.3, 0.3, 0.3)
        wait()
    logo.ImageColor3 = Color3.new(0.4, 0.4, 0.4)
        wait()
    logo.ImageColor3 = Color3.new(0.5, 0.5, 0.5)
        wait()
    logo.ImageColor3 = Color3.new(0.6, 0.6, 0.6)
        wait()
    logo.ImageColor3 = Color3.new(0.7, 0.7, 0.7)
        wait()
    logo.ImageColor3 = Color3.new(0.8, 0.8, 0.8)
        wait()
    logo.ImageColor3 = Color3.new(0.9, 0.9, 0.9)
        wait()
    logo.ImageColor3 = Color3.new(1, 1, 1)
        wait()
    logo.ImageColor3 = Color3.new(0.9, 0.9, 0.9)
        wait()
    logo.ImageColor3 = Color3.new(0.8, 0.8, 0.8)
        wait()
    logo.ImageColor3 = Color3.new(0.7, 0.7, 0.7)
        wait()
    logo.ImageColor3 = Color3.new(0.6, 0.6, 0.6)
        wait()
    logo.ImageColor3 = Color3.new(0.5, 0.5, 0.5)
        wait()
    logo.ImageColor3 = Color3.new(0.4, 0.4, 0.4)
        wait()
    logo.ImageColor3 = Color3.new(0.3, 0.3, 0.3)
        wait()
    logo.ImageColor3 = Color3.new(0.2, 0.2, 0.2)
        wait()
    logo.ImageColor3 = Color3.new(0.1, 0.1, 0.1)
        wait()
    logo.ImageColor3 = Color3.new(0.2, 0.2, 0.2)
        wait()
    logo.ImageColor3 = Color3.new(0.3, 0.3, 0.3)
        wait()
    logo.ImageColor3 = Color3.new(0.4, 0.4, 0.4)
        wait()
    logo.ImageColor3 = Color3.new(0.5, 0.5, 0.5)
        wait()
    logo.ImageColor3 = Color3.new(0.6, 0.6, 0.6)
        wait()
    logo.ImageColor3 = Color3.new(0.7, 0.7, 0.7)
        wait()
    logo.ImageColor3 = Color3.new(0.8, 0.8, 0.8)
        wait()
    logo.ImageColor3 = Color3.new(0.9, 0.9, 0.9)
        wait()
    logo.ImageColor3 = Color3.new(1, 1, 1)
        wait()
    logo.ImageColor3 = Color3.new(0.9, 0.9, 0.9)
        wait()
    logo.ImageColor3 = Color3.new(0.8, 0.8, 0.8)
        wait()
    logo.ImageColor3 = Color3.new(0.7, 0.7, 0.7)
        wait()
    logo.ImageColor3 = Color3.new(0.6, 0.6, 0.6)
        wait()
    logo.ImageColor3 = Color3.new(0.5, 0.5, 0.5)
        wait()
    logo.ImageColor3 = Color3.new(0.4, 0.4, 0.4)
        wait()
    logo.ImageColor3 = Color3.new(0.3, 0.3, 0.3)
        wait()
    logo.ImageColor3 = Color3.new(02, 0.2, 0.2)
        wait()
    logo.ImageColor3 = Color3.new(1, 1, 1)
        wait()
    button.Visible = true
    break
end
0
Do you want it to go on forever? What exactly is the intended result? amanda 1059 — 6y
0
Just for about 3 seconds. c5or 8 — 6y

2 answers

Log in to vote
0
Answered by
amanda 1059 Moderation Voter
6 years ago
Edited 6 years ago

Ultimately, you want it to go up from (.1, .1, .1) to (1, 1, 1), in .1 increments, and then back down the same way.

Doing this requires 2 separate for loops.

Lastly, you want to repeat the whole process above 3 times, which can be done by engulfing the whole thing in yet another for loop.

for loop structure

for x = startValue, endValue, increment do

end

the increment is defaulted to 1 if not specified

Below I make a few variables at the top, just for editing convenience.

local small = .1
local big = 1
local inc = .1
local dec = -.1

local reps = 3

--this loop repeats everything in it 3 times
for _ = 1, reps do
    -- this loop goes from .1 to 1
    for c = small, big, inc do
        logo.ImageColor3 = Color3.new(c, c, c)
        wait()
    end

    -- this loop goes from 1 to .1
    for c = big, small, dec do
        logo.ImageColor = Color3.new(c, c, c)
        wait()
    end
end
button.Visible = true
Ad
Log in to vote
0
Answered by
piRadians 297 Moderation Voter
6 years ago

Hi. Use for loops, or tweeningservice, but i'm not sure if that works for color3.

for i = 0,1,0.1 do -- the first parameter is the "start", the second is the "end", and the third is the increment, or how much you want it to increase each "time", change it to whatever you seem fitting.
logo.ImageColor = Color3.new(i,i,i)
end
wait(0) -- how many seconds you'd like

for i = 1,0,-0.1 do -- again, but we are going "down" now.
logo.Imagecolor = Color3.new(i,i,i)
end

This should work. Thanks.

0
The first part of the script works to a certain point, then it just goes black and stops working. c5or 8 — 6y
0
I thought that was what you wanted? I mean, it goes from 0 to 1, then from 1 to 0, what exactly do you want it to be? piRadians 297 — 6y
0
It doesn't go from 1 to 0, it breaks after 0 to 1 c5or 8 — 6y
0
Then just erase everything after the first "end" including the wait() but not the end. piRadians 297 — 6y
View all comments (3 more)
0
Now it just stays black. c5or 8 — 6y
0
change the "1" to 255. 255 should make it go from black to white changing in grey tones. piRadians 297 — 6y
0
Still doesn't seem to work. Thanks anyway. c5or 8 — 6y

Answer this question