Any ideas on how could I make a 'block bomb'?

need help to figure out how to throw the parts in random directions, tried Velocity, VectorForce and Explosion.

code:

local exploding = false
game.Players.PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		local hum = c:FindFirstChild("Humanoid")
		hum.Changed:Connect(function()
			if hum and hum.Health == 0 and exploding == false then
				explode(c.PrimaryPart.Position, c.PrimaryPart.BrickColor)
				
				exploding = true
			end
		end)
	end)
end)

function explode(pos, color)
	for i = 0, 20, 1 do
		local p = Instance.new("Part", workspace)
		p.Size = Vector3.new(1,1,1)
		p.Position = pos
		p.BrickColor = color
	end
end
1 Like
local exploding = false
game.Players.PlayerAdded:Connect(function(p)
	p.CharacterAdded:Connect(function(c)
		local hum = c:FindFirstChild("Humanoid")
		hum.Changed:Connect(function()
			if hum and hum.Health == 0 and exploding == false then
				explode(c.PrimaryPart.Position, c.PrimaryPart.BrickColor)

				exploding = true
			end
		end)
	end)
end)

function explode(pos, color)
	for i = 0, 20, 1 do
		local p = Instance.new("Part", workspace)
		p.Anchored = false
		p.Size = Vector3.new(1,1,1)
		p.Position = pos
		p.BrickColor = color
	end
	local explosion = Instance.new("Explosion")
	explosion.BlastRadius = 60
	explosion.ExplosionType = Enum.ExplosionType.Craters -- damages terrain
	explosion.Position = pos
	explosion.Parent = workspace
end
1 Like

This should Create an explosion where you die causing all the parts to go away (Also made sure that the parts were unanchored)

Ive tried it already and it didn’t quite work

This exact Script works for me, If the Players Humanoid Health is 0 , it’ll create lots of parts and add an explosive to throw blow them away.

Are the parts being stacked on top of each other when you create them?

From what I Remember, they were forming a line (Because they are collusive and they pushed each other a little apart) before they blew up

That’s why i considered it a fail, but maybe If I set a collision group to baseplate only it will work

I’m pretty sure that’s fine, Here is how it looks
https://gyazo.com/6ffde89fc7eeb13c0bd2e93dd724a1b1