Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Any way to make particles transparent with a for i loop?

You know how you can make parts transparent with a for i loop? Is there a way to do the same with ParticleEmitters? I tried

for i = 1, 20 do
PE.Transparency = NumberSequence.new(0.2,0.5)
wait()
end

and other things like that. Any suggestions?

3 comments

0

please properly indent your code

0

indenting doesnt matter?

0

It matters when you want others and yourself to properly read it.

2 answers

That is quite a simple method you can do. You could do this just as simple:

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

I'll give some background into the code. "i" will represent the starting point of the transparency which will be 0. The number 1 will represent the desired number you would like to reach. Then .1 will represent the number increment so each time it will go up by .1. As an example: .1, .2 ,.3, .4, .5, .6, .7, .8, .9, 1 and stops at 1.

1 comment

0

please properly indent your code.

ParticleEmitters and Trails both take NumberSequences for Transparency.

Looking at RobloxDev on NumberSequences:

NumberSequence.new ( number n )

Using this we can count up towards 1 until the particle emitter is completely invisible.

local PE = script.Parent:WaitForChild("ParticleEmitter")

for i = 0, 1, .05 do
	PE.Transparency = NumberSequence.new(i)

	wait()
end

This loops from 0 to 1 with an increment of .05 every 1/30 a second.

1 comment

0

I completely overlooked that it was a ParticleEmitter.

This discussion is preserved as it was. New answers, comments, and votes are closed.