Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make this go the other way with a fade?

Asked by 7 years ago

Right now, this script fades it out... I can't get it to fade in. If someone could help that would be amazing!

for i = 0,.6,0.01 do
    script.Parent.Decal.Transparency = i
    wait()

end

2 answers

Log in to vote
1
Answered by 7 years ago

To change the outcome of a for loop you can simply switch the first two variables, and then make the third variable negative.

Here is your final script:

for i = .6,0,-0.01 do
    script.Parent.Decal.Transparency = i
    wait()
end
0
You will lose precision on an operation like this. In most cases, you should use an integer as your start, step, and destination, and divide your control variable to get the result. ScriptGuider 5640 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

I think you need to switch the first two numbers to fade the other way. Also make the number negative.

for i = .6,0,-0.01 do -- Switch the first two numbers to do the opposite. Also make the number negative.
    script.Parent.Decal.Transparency = i
    wait()

end

Try that and see if it works.

0
You forgot the number has to be negative User#9949 0 — 7y

Answer this question