Right now I got
for i = 0, 10 do 2 script.Parent.Transparency = script.Parent.Transparency + 0.1 3 wait() 4 end
But as it is not a while loop and it is a for loop I want to repeat it, but how do I do this? I want it like to repeat immediately after each other. Thanks!
There are two different ways. First one is the suggested way and does not include while. Second one however, includes while. Still effective but not suggested. By the way first index in lua is 1. Start for loops from 1.
First one is basically calling a function whenever you want.
local function DoTransparencyThing() for i = 1,10 do wait() script.Parent.Transparency = script.Parent.Transparency + 0.1 end end DoTransparencyThing()
So whenever the line "DoTransparencyThing()" runs, this function will run. However if you want to run this function over and over, you might need a while loop with a wait.
Now the while loop.
while true do for i = 1,10 do wait() script.Parent.Transparency = script.Parent.Transparency + 0.1 end wait() script.Parent.Transparency = 0 end
See that wait() at the end? This is to let it wait before starting process again. Also making transparency 0 so it can be transparent with the loop again.
EXTRA
However, increasing a number value with for loop isn't the best way to do it. There are tweens which can do these without keeping you with a wait time I suggest you to research TweenService for more information.
Note: If this helped, can you upvote and accept as answer please? Upvote is very important for me, thanks <3