How to explode part on touch?
✓ ANSWER ACCEPTED
How to explode part on touch?
1 answer
✓ Accepted answer
Insert a script into a part and inside the script type this:
local delayTime = 3 -- How long (in seconds) to wait after an explosion.
local currentlyDelaying = false -- Don't touch this.
script.Parent.Touched:connect(function(hit)
if currentlyDelaying == false then
local exp = Instance.new("Explosion", script.Parent)
exp.BlastPressure = 500000 -- The pressure of the explosion
exp.BlastRadius = 4 -- The radius of the explosion
exp.DestroyJointRadiusPercent = 1 -- The radius of where joints are destroyed upon impact
exp.ExplosionType = Enum.ExplosionType.Craters -- What type of explosion do you want? Craters, CratersAndDebris, or NoCraters.
exp.Position = script.Parent.Position -- The position of the explosion
exp.Visible = true -- If the explosion can be seen
currentlyDelaying = true -- Sets currentlyDelaying to true so that the code will be ignored
wait(delayTime) -- Waits the delay time.
currentlyDelaying = false -- Sets currentlyDelaying to false so that the code will no longer be ignored.
end
end)
This will create a nice powerful explosion on the part. Anyone who touches it will instantly be blown to bits!
Hope I helped! :)
This discussion is preserved as it was. New answers, comments, and votes are closed.
