PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

ExplosionType

Explosion

ExplosionType

This property determines how the Explosion will interact with Terrain. 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 the Explosion/BlastRadius. Craters are created in all Terrain materials other than water. The size of the crater is not influenced by the material, although some materials create rougher edges than others.


Code Samples


Stop Explosions from Damaging Terrain

This code sample includes an example of how the Explosion.ExplosionType property can be used to stop Explosions from damaging terrain. It is recommended to set the ExplosionType to NoCraters at the point of Explosion instantiation, but if that is not practical the code below will work.

game.Workspace.DescendantAdded:Connect(function(descendant)
	if descendant:IsA("Explosion") then
		descendant.ExplosionType = Enum.ExplosionType.NoCraters
		descendant:GetPropertyChangedSignal("ExplosionType"):Connect(function()
			descendant.ExplosionType = Enum.ExplosionType.NoCraters
		end)
	end
end)