Explosions are Roblox objects that simulate the effect of an explosion. When exploding, they push parts away and create craters in the nearby terrain. Explosions will also break the joints of nearby parts.
Explosions will only be displayed and have an effect if they are located in the workspace. They will disappear immediately after exploding. The following code will create an explosion, put it in the workspace and create a reference to it in the variable explosion:
local explosion = Instance.new("Explosion", workspace)
Explosions have a property called 'Position', like parts. That property can be used to set the position where they will explode. Note that putting an explosion in a part or in a model will not make it explode close to that model or part unless you set its position accordingly. In this case, let's put it at the position :
explosion.Position = Vector3.new(1, 2, 3)
Explosions also have two other properties: BlastRadius and BlastPressure. The first defines the radius of the explosion and the second defines its pressure. The radius is the distance the explosion will cover, while the pressure is how strongly it will push parts away.
The default pressure is 500000. That is enough to create an average explosion (imagine the explosion produced by the classic rocket launcher). If explosions have very low pressure, they will not push parts and break joints. This can be used to get the visual effect without affecting the game. Let's say we don't want a very powerful explosion, so we'll set the pressure to 5000 and the radius to 8 (which is the double of the default radius of 4):
explosion.BlastPressure = 5000 explosion.BlastRadius = 8
A third property, the ExplosionType property, can be used to set the type of the explosion. The type of explosion can be used to make it behave differently with the terrain. Let's pretend we want an explosion that pushes parts away and breaks joints, but doesn't destroy the terrain:
explosion.ExplosionType = Enum.ExplosionType.NoCraters
Explosions also have an event called the Hit event. It fires when the explosion hits a part and gives, as arguments, the part and the distance from it and the center of the explosion (before it was pushed away, that is). With this event, you could, for example, make parts disappear when they are hit by an explosion or add a Fire object in them to make them look like they're burning.
2006-Mid 2007: Explosions looked like a red ball. If a Robloxian touches it, they instantly get killed. If a brick is in the range, it flies apart without decreasing explosion pressure.
2007–2009: Explosions looked more like a real explosion, with an orb at the center, functions are the same as 2006–2007.
2009–2012: Explosions were made slightly brighter. And the orb is removed, same as 2006–2007 from functions.
2012–2014: Explosions were extremely darker. Same functions as 2006–2007.
Early 2014–Late 2014: Explosions in the client were constantly disappeared in 1 second when Roblox's own engine was implemented, same as functions as 2006–2007.
2014–2015: Explosions are now much more realistic and brighter, and a shockwave emits from it, the same functions as 2006–2007.
2015-present: Explosions are slightly brighter, they create a white light as it occurs, and they sent small lava bombs (that will kill you if you are near the explosion).