I have a brick I want to go from almost 0 transparent to almost .8 in transparency over and over, can anyone help?
while true do for i = 0, .8, .01 do script.Parent.Transparency = i wait(.05) for i = .8, 0, .01 do script.Parent.Transparency = i wait(.05) end end end
Tab your code properly. That is vital for you to become a good scripter!
while true do for i = 0, .8, .01 do script.Parent.Transparency = i wait(.05) for i = .8, 0, .01 do script.Parent.Transparency = i wait(.05) end end end
Notice how you have the second for
loop inside the first one? That's not right -- you want the second one to happen after, not during it.
while true do for i = 0, .8, .01 do script.Parent.Transparency = i wait(.05) end for i = .8, 0, .01 do script.Parent.Transparency = i wait(.05) end end
Now the first for
loop will work as expected, but the second won't; .8
is larger than 0
, but you're telling it to go up (+.01
). You need to tell it to go down by giving a negative step:
while true do for i = 0, .8, .01 do script.Parent.Transparency = i wait(.05) end for i = .8, 0, -.01 do script.Parent.Transparency = i wait(.05) end end