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

How can I make a ImageButton smoothly flicker?

Asked by 5 years ago
Edited 5 years ago

I want a light to smoothly flicker, what I mean is when I want the transparency to go up, it scrolls across all the numbers going up, and when the transparency is at 1, it scrolls down.

My code works, but it's really long.

while true do
    -- out
    wait(0.01)
    script.Parent.ImageTransparency = .1
    wait(0.01)
    script.Parent.ImageTransparency = .2
    wait(0.01)
    script.Parent.ImageTransparency = .3
    wait(0.01)
    script.Parent.ImageTransparency = .4
    wait(0.01)
    script.Parent.ImageTransparency = .5
    wait(0.01)
    script.Parent.ImageTransparency = .6
    wait(0.01)
    script.Parent.ImageTransparency = .7
    wait(0.01)
    script.Parent.ImageTransparency = .8
    wait(0.01)
    script.Parent.ImageTransparency = .9
    wait(0.01)
    script.Parent.ImageTransparency = 1
    wait(0.01)
    -- in
    script.Parent.ImageTransparency = .9
    wait(0.01)
    script.Parent.ImageTransparency = .8
    wait(0.01)
    script.Parent.ImageTransparency = .7
    wait(0.01)
    script.Parent.ImageTransparency = .6
    wait(0.01)
    script.Parent.ImageTransparency = .5
    wait(0.01)
    script.Parent.ImageTransparency = .4
    wait(0.01)
    script.Parent.ImageTransparency = .3
    wait(0.01)
    script.Parent.ImageTransparency = .2
end

Please tell me what I need to do.

0
You forgot a wait(). coolboy6786543 113 — 5y
0
Can you provide the code that 'across all the numbers going up, and when the transparency is at 1, it scrolls down.', because this doesn't really 'change' or 'scroll' anything. Your code isn't really matching what you're saying at all. pidgey 548 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
while (true) do
    for i=.1,10 do
        script.Parent.ImageTransparency = i;
    wait(0.02);
    end
    for i=1,10 do
        script.Parent.ImageTransparency = 1 - i;
    wait(0.02);
    end
end;

Boom. Should work now.

0
I wanted it to scroll through numbers like 0.1,0.2,0.3,0.4... without haing to write a really long script dialtcp 2 — 5y
Ad

Answer this question