I tried making a script in which the brick slowly disappears and then slowly reappears after, and this goes on infinitely. But it isn't working, here is the script:
t = script.Parent.Transparency while true do for i=1,10 do t = t + 0.1 wait(1) end wait(1) for i=1,10 do t = t + 0.1 wait(1) end end
local t = script.Parent while true do for i=1,10 do t.Transparency = t.Transparency + 0.1 -- Addend wait(1) end for i=1,10 do t.Transparency = t.Transparency - 0.1 -- Subtraction wait(1) end end
The script is going disappear forever cause you are ALWAYS adding transparency:
t = script.Parent.Transparency while true do for i=1,10 do t = t + 0.1 wait(1) end wait(1) for i=1,10 do t = t - 0.1 -- you said here t = t + 0.1 wait(1) end end
Protip: Instead of adding, you can make the things happen on i var, like this:
t = script.Parent.Transparency while true do for i = 0, 1, 0.1 do -- it goes from 0 to 1, adding 0.1 t = i wait(1) end wait(1) for i = 1, 0, -0.1 do -- going from 1 to 0, subtracting 0.1 t = i wait(1) end end
as everyone on the comments and I said, you should give objects to the vars and changing their properties, like this:
t = script.Parent while true do for i = 0, 1, 0.1 do -- it goes from 0 to 1, adding 0.1 t.Transparency = i wait(1) end wait(1) for i = 1, 0, -0.1 do -- going from 1 to 0, subtracting 0.1 t.Transparency = i wait(1) end end