I created an explosion effect through multiple particle emitters and I don’t know how to implement that. In the explosions Documentation, under “Explosion Custom Visuals”, the script is as easy as just replacing the Instance.new("ParticleEmitter") with my particles right? No, like I said, I have multiple particle emitters and while I could try putting multiple emitters in the script, I don’t know if there is a better way to do this. I also don’t understand script to the fullest extent, so I don’t entirely know what I’m doing as you can probably tell by this post.
but the effect is working fine if you mean to make the code simpler to not write the properties of the emitter then you can keep a copy of it and reference it through your script
something like this
local explosion = script.Explosion_ParticleEmitter
local function startExplosion(instance :Instance, numberOfExplosions)
for i=0, numberOfExplosions do
local newExplosion = explosion:Clone()
newExplosion.Parent = instance
-- the rest of the code
end
end
That gif was taken in the editor, not in the game. The problem I’m facing is the fact that my explosion is made up of multiple particle emitters which I don’t know how to implement it.
i just checked the docs
you can have a folder containing your emitters and then loop through it in the script
example - from line 10
local function customExplosion(position)
local explosion = Instance.new("Explosion")
explosion.Position = position
explosion.Visible = false
local attachment = Instance.new("Attachment")
attachment.Position = position
attachment.Parent = workspace.Terrain
for _, emitter :ParticleEmitter in script.EmittersFolder:GetChildren() do
local particleEmitter = emitter:Clone()
particleEmitter.Enabled = false
particleEmitter.Parent = attachment
particleEmitter.Speed = NumberRange.new(5, 30)
particleEmitter.SpreadAngle = Vector2.new(-90, 90)
explosion.Parent = workspace
particleEmitter:Emit(20)
task.delay(5, function()
if attachment then
attachment:Destroy()
end
end)
end
end
customExplosion(Vector3.new(0, 0.5, 0))