Custom Visual Explosion Problem

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.

My Effect:
Untitledvideo-MadewithClipchamp3-ezgif.com-video-to-gif-converter

2 Likes

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
3 Likes

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.

2 Likes

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))

{E62ADEC1-4E90-498F-889E-46B1EEB1478F}

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.