I find changing the transparency of a frame by doing this is not efficient at all.. I'm trying to create a fade effect but I heard there is something easier to do this with less lines of code.
And how would I do the same thing to multiple frames at once?
Example of bad code
Frame.Transparency = 0.1 wait(0.1) Frame.Transparency = 0.2 wait(0.1) Frame.Transparency = 0.3 wait(0.1) Frame.Transparency = 0.4 wait(0.1) Frame.Transparency = 0.5 wait(0.1) Frame.Transparency = 0.6 wait(0.1) Frame.Transparency = 0.7 wait(0.1) Frame.Transparency = 0.8 wait(0.1) Frame.Transparency = 0.9
In Lua, there are many different kind of loops, repeats, while, and for loops, and for this, the best choice would be a for loop. You also need to recognize where frame is from.. I'm thinking thats in StarterGui in a ScreenGui.
local frame = game.StarterGui.ScreenGui.Frame for i = 1, 9, .1 do frame.Transparency = i wait() end
And to do it for multiple frames, I would personally variables as I did with local frame, for example:
frame = game.StarterGui.ScreenGui.Frame frame2 = game.StarterGui.ScreenGui.Frame2 frame3 = game.StarterGui.ScreenGui.Frame3 for i = 1, 9, .1 do frame.Transparency = i frame2.Transparency = i frame3.Transparency = i wait() end
For more information on loops