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

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

What is the fxmod? I’m confused.

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.

1 Like

But didn’t you say…

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.

2 Likes

Ohhhh I see. Thanks.
:slight_smile:

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.

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

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

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