From http://wiki.roblox.com/index.php?title=Making_an_Explosion_Course
I don't understand how adding random number from 1-3 can make different parts explode at different times. If I "remove number = math.random(1,3)" and the if condition that checks for 1, my parts would explode at the same time. How does it change the behavior of my "ExplodePart"s from exploding uniformly at the same time to exploding at different times? How does math.random choose which parts explode at random times rather than all parts explode at random times?
function ExplodePart(part)
number = math.random(1,3)
if number == 1 then
explosion = Instance.new("Explosion", game.Workspace)
explosion.Position = part.Position
end
end
children = game.Workspace:GetChildren()
while true do
for _, child in ipairs(children) do
if child.Name == "ExplosionPart" then
ExplodePart(child)
end
end
wait(1)
end

4 comments
Well, it has a one in three chance to explode, because math.random(1,3) and then it has a one in three chance of being one. So it will constantly do this, and if every single time it''s not one, then it won't explode.
you could also put this instead of line 2. wait(math.random(1,3))
That's not quite how it works Sporkyz
math random 1,3 means 1 incuded 3 excluded.