Custom Explosion Module - Create custom explosion effects easily

About

The Custom Explosion module does exactly what the name would suggest: it allows you to easily make custom explosion effects that act like normal explosions. Getting started requires very little scripting experience, but advanced users can still create more advanced explosion effects and behaviors.


Features

  • Create custom explosion effect templates without writing a single line of code
  • Detect hits and destroy the environment just like regular Explosion instances
  • Define custom behaviors for effects

How to use

Every custom explosion object created using this module is based on an explosion template. A template is essentially a folder containing the required effects such as Particle Emitters, Lights and Sounds. Creating templates does not necessarily require any scripting knowledge.

To create an explosion template, follow the steps below:

  1. Create a new Folder inside the Templates folder.
  2. Give the new Folder a unique name.
  3. Insert the effects (Particle Emitters, Lights etc.) to the new Folder.

To create a basic explosion, the following steps are required:
  1. Require the CustomExplosion module from a script.
  2. Create a new Explosion with CustomExplosion.new(“Your template name here”)
  3. Set the Explosion’s position with Explosion:SetPosition()
  4. Set the Explosion’s parent to workspace with Explosion:SetParent(workspace)

For more advanced behaviors such as sound effects before the explosion happens and hit detection, refer to the documentation bundled with the module.

Example

An example of what the module can achieve.


Links

72 Likes

hey mate, amazing module! however I’m having problems with it, I’m using this module so i can make explosions that can damage.

the documentation within the module didn’t give examples on how to damage a player using it, and there is another paramater that wasn’t in the documentation either. that being distance. upon using the Hit function it doesn’t damage any players. as shown here (https://gyazo.com/64f07909e63d89659ccd3f713f88c293)

is there also be a paramater that i can set that will check if it can destroy blocks?

task.spawn(function()
local newExplosion = Explosion.new(“NievaExplosion”,false)
newExplosion.Lifetime = 3
newExplosion:SetEffectFunction(CEF)
newExplosion:SetCFrame(AttackBlade.CFrame)
newExplosion:SetParent(workspace)

local c2
c2 = newExplosion.Hit:Connect(function(hit,dist)
    if hit.Parent:FindFirstChild("Humanoid") then
        print(".......................")
        if dist < 30 then
            fxmod.TakeDamage(Character,hit.Parent,8,100)
        end
    end

    c2:Disconnect()
end)

end)

1 Like

What is the fxmod? I’m confused.

1 Like

I looked at your code and tested it in-game with the assumption that fxmod.TakeDamage() is the equivalent to Humanoid:TakeDamage(). It worked the way it should, so assuming there’s nothing wrong with the fxmod.TakeDamage() function, you’re probably using a BlastRadius that’s too small. You can set this with newExplosion.ExplosionInstance.BlastRadius = x.

As for the parameter you asked about, you can simply create one yourself with newExplosion.CanDestroyParts = true and then checking if said attribute exists with

if newExplosion.CanDestroyParts then
    -- Do something
end

Finally, I’ve updated the model. The documentation now mentions the distance parameter of the Hit event, I had completely forgotten it exists when I made this.

2 Likes

But didn’t you say…

1 Like

Yes, creating the explosion templates doesn’t require anything but putting particle emitters and other effects in a folder. Making these templates appear as explosions in-game does require a bit of scripting.

4 Likes

Ohhhh I see. Thanks.
:slight_smile:

1 Like

fxmod is my main module, i handle things there like player damage, healing, vfx, mesh-related stuff and a lot more. However I’ve already fixed my problem with TenX29’s post as well as tinkering with the module.

1 Like

can you publish an example place as having issues getting working?

1 Like

Could you make the example place uncopylocked so we can look at the code?

2 Likes

When I tried using this explosion module, I noticed that it kills the player. How would I make it only damages the player?

1 Like

I have the same issue. I don’t want it to damage or kill the player at all but I can’t find anywhere in the documentation how to do this and I can’t find anything that does damage to the player in the module either.

Edit: Looks like I found out how to do it, I’m not sure about doing a certain amount of damage though. I’m pretty sure with this you can either turn damage off entirely or have it kill the player

        local NewExplosion = Exposion.new("Example2")
		NewExplosion.ExplosionInstance.BlastRadius
		NewExplosion.ExplosionInstance.BlastPressure
		NewExplosion.ExplosionInstance.DestroyJointRadiusPercent
1 Like

is there an event that gets triggered when exploding? I don’t want the explosion to break the map, but I also want it to damage the players around it.

1 Like

nvm im dumb, didnt know explosion.Hit existed

1 Like

Could you please make the example place open source along with the died message?

1 Like

I have no idea why, but when explosion is created, only light and sound get enabled, but not the particle emitters.
No errors or anything, output is clear.

Nevermind, just fixed it by editing behavior of explosion effects.