I was wondering how to smoothly fade out a block with the transparency value
this is my code so far
1 | for i = 1 , 10 -. 1 do |
2 |
3 | script.Parent.Transparency = (i) |
4 | end |
this instantly fades out the block when I run the game, is there any way to delay the counting so its slower and not instant?
You forgot to add a wait() into it so it would instantly fade, plus you didn’t put the right values on the loop for transparency, as it’s supposed to be 1,0 or 0,1.
Here’s a fixed version of your script :
1 | for i = 0 , 1 , . 1 do |
2 | wait(. 1 ) |
3 | script.Parent.Transparency = i |
4 | end |
You can change the 0, 1 into 1, 0 if you want it to fade in. You can also change the wait() if you want it to fade faster or slower.
1 | for i = . 01 , 1.01 , . 01 do |
2 | script.Parent.Transpareny = (i) |
3 | wait(. 01 ) |
4 | end |
Change the wait function to a higher number like .02 if you wanted it to go faster.