Class · inherits Instance
Explosion
Applies force to BaseParts within the explosion's
Explosion.BlastRadius. Breaks JointInstances and
WeldConstraints between parts and kills
Humanoid characters not protected by a ForceField.
About Explosion
An Explosion applies force to BaseParts within the
explosion's BlastRadius. This force breaks
JointInstances and
WeldConstraints between parts and kills
Humanoid characters not protected by a ForceField.
Constraints will not be broken by an explosion.
If an Explosion is parented anywhere in the data model while the
experience is running, it immediately sets off and, within a few seconds, it
becomes unparented. It is not destroyed with Instance.Destroy in
this case, so connections do not get disconnected and the parent is not
locked. As with all instances, keeping a strong reference an Explosion
will prevent it from being garbage collected.
Note that an Explosion must be a descendant of Workspace for
the explosion visuals to play and the physical/damaging effects to have an
impact.
Explosion Effects
Humanoids are killed by explosions, as the explosion breaks
the character Model neck joint. Parenting a ForceField to a
model will protect all of its children from the explosion kill effect.
If you do not want joints between BaseParts to be broken, or
you want to implement your own formula for damaging
Humanoids, it's recommended that you set
DestroyJointRadiusPercent to 0 and
use the Hit event to handle the result of the explosion.
Explosions can also be configured to damage Terrain, creating craters,
as configured through the ExplosionType
property.
Note that the effect of an explosion is not disrupted by obstacles, meaning that parts/terrain shielded behind other parts/terrain will still be affected.
Properties 8
BlastPressure
: floatUsed to determine the amount of force applied toBasePartscaught in theExplosion.BlastRadius.Used to determine the amount of force applied to
BasePartscaught in theExplosion.BlastRadius.Currently this level of force applied does not vary based on distance from
Explosion.Position. UnanchoredBasePartswill accelerate equally away from the origin regardless of distance provided they are within the blast radius.The blast pressure determines the acceleration of parts due to an explosion. It does not determine the degree to which joints are broken. When
Explosion.DestroyJointRadiusPercentis equal to 1 all joints between parts in theExplosion.BlastRadiuswill be destroyed provided BlastPressure is greater than 0.The BlastPressure also does not determine the amount of damage given to
Terrain. Provided BlastPressure is greater than 0 andExplosion.ExplosionTypeisn't set to Enum.ExplosionType.NoCraters the size of the crater created is determined exclusively by theExplosion.BlastRadius.Setting BlastPressure to 0 eliminates the effect of the explosion and is useful when developers want to program their own custom behavior for explosions using the
Explosion.Hitevent.BlastRadius
: floatThis property determines the radius of theExplosion, in studs. This radius determines the area of effect of the explosion, not the size of the explosion's visuals.This property determines the radius of the
Explosion, in studs. This property accepts any value between 0 and 100.This radius determines the area of effect of the Explosion, not the size of the Explosion's visuals. The size of the Explosion's visual effect is the same regardless of BlastRadius (even if BlastRadius is 0).
BasePartswithin the BlastRadius will be affected by the explosion. Meaning, ifExplosion.BlastPressureis greater than 0, force will be applied to parts. The degree to which joints are broken within the BlastRadius depends onExplosion.DestroyJointRadiusPercent.Explosion.Hitwill fire for any everyBasePartwithin the radius.BasePartsare considered withinExplosion.BlastRadiuseven if they are only partially in range.DestroyJointRadiusPercent
: floatUsed to set the proportion of theExplosion.BlastRadius, between 0 and 1, within which all joints will be destroyed. Anything outside of this range will only have theExplosionforce applied to it.Used to set the proportion of the
Explosion.BlastRadius, between 0 and 1, within which all joints will be destroyed. Anything outside of this range will only have theExplosionforce applied to it.For example, if
Explosion.BlastRadiusis set to 100 and DestroyJointRadiusPercent is set to 0.5, any joints within a radius of 50 studs would be broken. Any joints between the ranges of 50 and 100 studs wouldn't be destroyed, but theExplosionforce would still be applied to theBaseParts.This property allows developers to make
Explosions'non-lethal' toHumanoidsby setting DestroyJointRadiusPercent to 0. This means the neck joint will not be broken when characters come into contact with theExplosion.ExplosionType
: ExplosionTypeThis property determines how theExplosionwill interact withTerrain. Used to set if explosions will cause damage to the terrain or not.This property determines how the
Explosionwill interact withTerrain. It is an Enum.ExplosionType value and can be set to one of three options.- NoCraters - Explosions will not damage Terrain
- Craters - Explosions will create craters in Terrain
- CratersAndDebris - Redundant, behaves the same as Craters
If ExplosionType is set to create craters in
Terrain, the radius of the crater will be roughly equal to theExplosion.BlastRadius. Craters are created in allTerrainmaterials other than water. The size of the crater is not influenced by the material, although some materials create rougher edges than others.LocalTransparencyModifier
: floatHiddenNotReplicatedA multiplier for the transparency of theExplosionvisual effect that is only visible to the local client.A client-local multiplier for the transparency of the
Explosionvisual effect. It does not replicate from client to server and is useful when the explosion visual should appear differently for a specific client.A value of
0, the default, has no effect on the explosion's appearance, while a value of1makes the visual effect completely invisible to the local client. Values are clamped between0and1.This property does not alter the explosion's physical or damaging effects. To hide the visual effect for all clients while retaining force and damage, set
Visibletofalseinstead.Position
: Vector3This property is the position of the center of theExplosion. It is defined in world-space and not influenced by theExplosionparent.This property is the position of the center of the
Explosion. It is defined in world-space and not influenced by theExplosionparent.BasePartswill be influenced by theExplosionif they are withinExplosion.BlastRadiusstuds of the explosion's position.The effect of an explosion is instantaneous. This means that although the position of an explosion can be changed after it has been set it cannot affect two different areas. Once an explosion has been 'detonated', shortly after parenting it to a descendant of the
Workspace, it will not do so again. In some cases the visual effect of the explosion will move but it will have no effect.For this reason a new Explosion should be created if the developer wants an explosion to appear at a different position.
TimeScale
: floatValue between 0 and 1 that controls the speed of the particle effect.A value between 0 and 1 that controls the speed of the particle effect. At 1 it runs at normal speed, at 0.5 it runs at half speed, and at 0 it freezes time.
Visible
: booleanThis property determines whether or not the visual effect of anExplosionis shown or not.This property determines whether or not the visual effect of an
Explosionis shown or not.When Visible is set to false, the explosion will still affect
BasePartsin itsExplosion.BlastRadius, the only difference is it will not be seen.One use for this property would be for a developer to make their own custom explosion effects using a
ParticleEmitter, while retaining the defaultExplosionfunctionality.
Events 1
Hit
Explosion.Hit:Connect(function(part, distance))Fires when theExplosionhits aBasePartwithin itsExplosion.BlastRadius. Returns the part hit along with the distance of the part fromExplosion.Position.Fires when the
Explosionhits aBasePartwithin itsExplosion.BlastRadius. Returns the part hit along with the distance of the part fromExplosion.Position.Note that the effect of an
Explosionis not disrupted by obstacles, this means parts shielded behind other parts will still be hit, even if theBasePartthey are shielded behind is anchored.This event will also fire when
Explosion.BlastPressureis equal to zero. This means developers can program their own custom behavior for explosions by eliminating the explosion's influence onBasePartsandTerrain.Note that this event will fire for every
BaseParthit. This means it can fire multiple times for the same player character (as the characterModelis made up of multiple parts). For this reason when dealing custom damage using theExplosion.Hitevent it's recommended to implement a check to see if the character has already been hit by theExplosion.
Explosion also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.