Why won't my burger EXPLODE

I made an explosion script, however my burger doesn’t explode. How do I make it Explode?

	local explosion = Instance.new("Explosion")
	explosion.Position = position
	explosion.BlastRadius = radius
	explosion.Parent = game.Workspace
	explosion:Play()
end

script.Parent.Touched:Connect(function(BasePart)
	if BasePart.Name == "Burger" then
		createExplosion(Vector3.new(0, 5, 0), 5)
	end
end)

Have you tried debugging it? Maybe its not the explosion itself causing the error but there is an error with your TouchedEvent. Add a print line to both the createExplosion function and the innerpart of your if request.

local function createExplosion(position: Vector3)
        print("Function ran")
	local explosion = Instance.new("Explosion")
	explosion.Position = position
	explosion.BlastRadius = radius
	explosion.Parent = game.Workspace
	explosion:Play()
end

script.Parent.Touched:Connect(function(BasePart)
	if BasePart.Name == "Burger" then
               print("if request passed")
		createExplosion(Vector3.new(0, 5, 0), 5)
	end
end)
1 Like

It says that :Play() isnt a valid member.

Ah yeah.

As from my knowledge, explosions will instantly explode once they have been parented in the workspace. Just remove :Play()

1 Like

This doesn’t explode anything…

Does the part explodes when you try to :Destroy() it? I tried to do it one year ago and the part exploded when I destroyed it.

1 Like

Nevermind, I figured it out. I was exploding it nowhere near the part I wanted to explode it at.

local function createExplosion(position, radius)
	local explosion = Instance.new("Explosion")
	explosion.Position = position
	explosion.BlastRadius = radius
	explosion.ExplosionType = Enum.ExplosionType.NoCraters
	explosion.Parent = game.Workspace
end

script.Parent.Touched:Connect(function(BasePart)
	if BasePart.Name == "Burger" then
		createExplosion(Vector3.new(-276.998, 3.339, -60.125), 5)
	end
end)

Can u just make an print screen of game’s workspace and post it here?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.