Should there be any improvements with this meteor script i made?

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

3 Likes

You’ll need e.Touched() instead.

Doesn’t the explosion instance already make a sound?

Also let’s see it in action come on, let me see how it works. I can give feedback and and tips on how it could and should look and scripting tips afterwards.

I’d suggest re-writing the whole thing. Not to be rude, but the code is really confusing.

Guys this is a 3 year old thread… :flushed:

1 Like