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

Visible

Explosion

bool

This property determines whether or not the visual effect of an Explosion is shown or not.

When Visible is set to false, the explosion will still affect BaseParts in its Explosion/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, whilst retaining the default Explosion functionality.


Code Samples


Explosion Custom Visuals

This sample includes a function that will create an Explosion but replace the default Explosion visuals but those of a ParticleEmitter.

local Debris = game:GetService("Debris")

local function customExplosion(position)
	local explosion = Instance.new("Explosion")
	explosion.Position = position
	explosion.Visible = false 
	
	local attachment = Instance.new("Attachment", workspace.Terrain)
	attachment.Position = position
	
	local particleEmitter = Instance.new("ParticleEmitter")
	particleEmitter.Enabled = false 
	particleEmitter.Parent = attachment 
	particleEmitter.Speed = NumberRange.new(5, 30)
	particleEmitter.SpreadAngle = Vector2.new(-90, 90)

	explosion.Parent = workspace 
	particleEmitter:Emit(20)

	Debris:AddItem(attachment, 5) -- clean up attachment
end