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