Hello I was wondering how I can achieve a transition of making my particle emitter slowly fade. I am confused on how to achieve and IMPLEMENT this. Could someone please help me?
local particle = script.Parent.ParticleEmitter --THIS IS THE PARTICLE EMITTER THAT WILL CHANGE.
local setting = {
wait_time = 1, --HOW MUCH TIME THAT SHOULD WAIT AFTER THE SMOKE APPEARS OR FADES
fade_time = 0.3, --HOW FAST IT TAKES TO FADE/APPEAR
min_fade = 0, --HOW MUCH SMOKE TO APPEAR. ( 0 = NOT TRANSPARENT, 1 = VERY TRANSPARENT )
max_fade = 1, --HOW MUCH SMOKE TO DISAPPEAR ( 0 = NOT TRANSPARENT, 1 = VERY TRANSPARENT )
}
----------------- -----------------
while true do --Infinite loop.
task.wait(setting.wait_time)
--MAKE THE PARTICLE APPEAR:
while particle.Transparency > setting.min_fade do
task.wait(setting.fade_time)
particle.Transparency = particle.Transparency - 0.05 --Slowly fade the transparency.
if particle.Transparency <= setting.min_fade then
particle.Transparency = setting.min_fade --Make the particle final transparency to 0.
break; --End THIS loop.
end
end
task.wait(setting.wait_time)
--MAKE THE PARTICLE DISAPPEAR:
while particle.Transparency < setting.max_fade do
task.wait(setting.fade_time)
particle.Transparency = particle.Transparency + 0.05 --Slowly fade the transparency.
if particle.Transparency >= setting.max_fade then
particle.Transparency = setting.max_fade --Make the particle final transparency to 0.
break; --End THIS loop.
end
end
end