Yo, I’m trying to make a bomb chaining system in my game. Currently, bombs are handled in the script for the hammers, any idea how to make the bombs chain?
Here’s the current code for the bomb detection.
function detect(thing)
if thing.Parent.Name == "Engine" or thing.Name == "Bomb" then
local kaboom = Instance.new("Explosion")
kaboom.BlastRadius = 10
kaboom.Parent = thing
kaboom.Position = thing.Position
kaboom.BlastPressure = 800000
kaboom.Visible = false
thing.CanCollide=false
thing.Transparency = 1
local what = game.ServerStorage["explosion part"]:Clone()
what.Position = thing.Position
what.Parent = workspace
what.ParticleEmitter:Emit(300)
what.explode:Play()
wait(2)
what:Destroy()
elseif thing.Name == "Nuke" then
local kaboom = Instance.new("Explosion")
kaboom.BlastRadius = 35
kaboom.Parent = thing
kaboom.Position = thing.Position
kaboom.BlastPressure = 1500000
kaboom.Visible = false
thing.CanCollide=false
thing.Transparency = 1
local what = game.ServerStorage["nuke part"]:Clone()
what.Position = thing.Position
what.Parent = workspace
what.ParticleEmitter:Emit(600)
what.explode:Play()
wait(2)
what:Destroy()
end
end
collide.Hit:Connect(detect) ---this is an explosion instance
Do you want it to set off all bombs within a certain radius? In which case you could just make a table of bombs within x magnitude of the bomb and then do function calls for every bomb in that table.
e.g
--explosions and stuff
function explosion_chain(tab)
for i,v in pairs(tab) do
explode(v)
end
end
Yes, I understand what you mean - but how are you deciding which bomb explodes next? Either way any sequence of bombs could be put into an ordered table and applied to a variation of the function I’ve typed.
You could just connect the detect function to the “kaboom” explosions’ Hit event. You would probably need a check like if thing.Transparency < 1 so that bombs that already exploded don’t explode again
Since you are using roblox explosions, you can connect a function to explosion.hit and check if the hit object is another bomb. Then you could somehow activate the other bomb, maybe by updating a value