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

Is it possible to make a for i loop for particle transparency?

Asked by 6 years ago

For some reason the transparency doesn't transition.

for i = 0,1,.05 do
    Particle.Transparency = NumberSequence.new(i)
    wait()
end

2 answers

Log in to vote
0
Answered by 6 years ago

Problems

  • Your script adds up by .05 really fast, and stops at 1. This will make the transparency seem instant as the loop only has to add up 2 times in like half or less a second.

  • Although I don’t know NumberSequence that much, I really don’t think it’s necessary for something like this.

Solutions

  • Make the third value in the for loop a small value (Ex: .01) or just make the wait a bit longer. You could do both.

  • Simply change “NumberSequence.new(i)” into “i”.

This is what it should look like :

for i = 0,1,.01 do
    Particle.Transparency = i
    wait()
end

If you want to adjust how fast or slow the loop goes, simply just mess around with the third value in the loop and the wait value.

0
NumberSequence is how it works for particles. DeathGunner132 120 — 6y
0
Try it in studio DeathGunner132 120 — 6y
0
^ Haven’t tested it, but I checked the wiki and it said Transparency was a NumberSequence value, so I guess you can use that if it works. User#20279 0 — 6y
0
How do you do bullet points on these answers? theCJarmy7 1293 — 6y
Ad
Log in to vote
0
Answered by
Nep_Ryker 131
6 years ago
Edited 6 years ago

Why not just do this?

for i = 1, 10 do
    Particle.Transparency = Particle.Transparency + 0.1
    wait(0.1) -- Or 0.01 for even smoother..?
end
-- "+" to make it more transparent
-- "-" to make it more visible
0
Yes but because there is no number inbetween wait() This will seem instant. Timmerman73 85 — 6y
0
I've tried that before. It doesn't work. DeathGunner132 120 — 6y
0
But what about just adding 0.1 between the ()? Or for even smoother 0.01? Nep_Ryker 131 — 6y

Answer this question