function OnTouch(boom)
local e = Instance.new("Explosion")
local SS = game:GetService("ServerStorage")
local CEP = SS.CustomExplosionP:Clone() -- Shockwave animation
CEP.Parent = workspace
CEP.Position = script.Parent.Position
--[[e.Hit:Connect(function(part,distance) -- make a function to anything that is in the blast explosion gets affected
local smoke =SS.Smoke:Clone()
smoke.Parent = part
end)]]
e.BlastPressure = 700000
e.BlastRadius = 70
e.Parent = workspace
e.Position = script.Parent.Position
--If you want to add sound on explosion
local Bsound = Instance.new("Sound")
Bsound.SoundId = "rbxassetid://440431180"
Bsound.Volume = 4
Bsound.PlaybackSpeed = 0.8 -- Pitch
Bsound.PlayOnRemove = true -- If it's parent is gone, sound will play
Bsound.Parent = script.Parent
script.Parent:Destroy()
end
script.Parent.Position = Vector3.new(math.random(-2000,2000),math.random(850,1000),math.random(-2000,2000))
script.Parent.BP.Position = Vector3.new(math.random(-500,500),math.random(-1,25),math.random(-500,500)) -- Set it's BodyPosition
script.Parent.Touched:Connect(OnTouch)
The e.Hit function part i can’t get it to work because the smoke doesnt appear on the parts, any help?
Edit: u can copy this code and put it in ur part cus its not 100% expect it to work fully