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

How would I make a efficient loop for this? (Click for more detail)

Say I have a TextLabel which has the text: "Loading..." in it. I want to efficiently loop it so it's text transparency smoothly runs through 1 to 0 in decimals. I know you can do something with the for i loop or some other loop but I'm not sure how.

I know this is like asking for a script but I have no idea cause I have been to Roblox wiki and tutorials but I need a clear explanation on how this works and how I would make it.

If you did not understand the top: I need a TextLabel with the text: "Loading..." to become transparent and nontransparent through out 0, 0.1, 0.2... to 1. For a few times (or a certain amount of time) then I have other plans. Like a the TextLabel just disappear.

Thank you very much for any support and feedback from this. I really need a answer.

1 answer

✓ Accepted answer

Try this:

local myBox = --INSERT BOX HERE

for cycle = 1, 5 do
	for transparency = 0, 1, 0.01 do
		wait()
		myBox.BackgroundTransparency = transparency
	end
	for transparency = 1, 0, -0.01 do
		wait()
		myBox.BackgroundTransparency = transparency
	end
end

Just change the number of cycles or put it in a while loop with a stop condition if you don't know how long it will be looping.

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