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

How can I make a ImageButton smoothly flicker?

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.

2 comments

0

You forgot a wait().

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.

1 answer

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.

1 comment

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

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