Advanced Model Scripting

local part = script.Parent
local group = game.Workspace.Main
local canChange = true

local function color(model)
    if canChange then
        for num, child in pairs(model:GetChildren()) do
            if child:IsA('Part') then
                print(child)
                child.BrickColor = BrickColor.new('Really red')
            elseif child:IsA('Model') then
                color(child)
            end
        end
        canChange = false
    end
end

local function pass(otherPart)
 local partParent = otherPart.Parent
 local humanoid = partParent:FindFirstChildWhichIsA('Humanoid')
 if humanoid then
  color(group)
 end
end


part.Touched:Connect(pass)