Explosion Course

Exploding Part

Where to put this script

In a script under the part

Script

local part = script.Parent
part.Anchored = true

local function explode()
    part.BrickColor = BrickColor.new("Really red")
    wait(2)
    local explosion = Instance.new('Explosion')
    explosion.Parent = game.Workspace
    explosion.Position = part.Position
    part.BrickColor = BrickColor.new("Medium stone grey")
end

part.Touched:Connect(explode)

Explosion Course

Designing the Course

Where to put this script?

Put this in a script under ServerScriptService

Script

local function explodePart(part)
    if part.BrickColor == BrickColor.Red() then
        local explosion = Instance.new("Explosion")
        explosion.Position = part.Position
        explosion.Parent = game.Workspace
        part.BrickColor = BrickColor.White()
    else
        local number = math.random(1,3)
        if number == 1 then
            part.BrickColor = BrickColor.Red()
        end
    end 
end
 
local 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