I want to know how developers transparent multiple particles using TweenService.
It seems that I can’t transparent multiple effects, because you can’t tween NumberSequence.
I don’t know how to do it, so I basically just did destroy on the part and it’s not good at all, that’s why I’m trying to understand how people are doing it.
I found only how to tween transparency of one ParticleEmitter on the Developer Hub (using NumberValue), but what if I want multiple effects to appear at some point and then they fade out smoothly?
For example, here is my script that I currently have: I start an animation, then the sound starts playing and then the Red Ball is appearing in my hand. After that an explosion appears, that includes multiple effects and it fades away after like 2 seconds. How to tween transparency of multiple ParticleEmitters?
local ParticleEmitter = -- Path To PE
local TweenInfo = -- TweenInfo.new(Dura,Style,Dir,Repeat,Backwards,Delay)
local TS = -- TweenService
local NumVal = Instance.new("NumberValue")
local Tween = TS:Create(NumVal,TweenInfo,{Value = --[[Transparency]])
NumVal.Changed:Connect(function()
ParticleEmitter.Transparency = NumberSequence.new(NumVal.Value)
end)
Tween.Completed:Wait()
NumVal:Destroy()
First of all there is no reason to parent the numbervalue and second why are you doing just TweenInfo. Add stuff to it. Maybe thats the issue? Also can you show me what line is 50?
Oh the issue is I showed you as in one instance. You were suppose to figure out how to make it into a table but ill show you:
local ParticleEmitter ={} -- PE table
local Dura = 2
local TweenInfo = TweenInfo.new(Dura)
local TS = game:GetService("TweenSerivce")
for i,v in pairs(ParticleEmitter) do
local NumVal = Instance.new("NumberValue")
local Tween = TS:Create(NumVal,TweenInfo,{Value = --[[Transparency]])
NumVal.Changed:Connect(function()
v.Transparency = NumberSequence.new(NumVal.Value)
end
game:GetService("Debris"):AddItem(NumVal,Dura)
end
This is because you’re doing ParticleEmitter = blahblah:GetChildren()- that is not an Instance. That is a table of objects inside the object you’re referencing.
Are you intending to call GetChildren on the ParticleEmitter?
If so, maybe iterate through the table of objects and apply the Transparency like so:
NumberValue:GetPropertyChangedSignal("Value"):Connect(function()
for _,particle in pairs(ParticleEmitter) do
particle.Transparency = NumberSequence.new(NumberValue.Value)
end
end)