local W={}local function w(W,w,Z)for W,d in pairs(W:GetChildren())do if d:IsA("\066\097\115\101\080\097\114\116")then d.Color=w or(BrickColor.new("\087\104\105\116\101")).Color d.Material=Z or Enum.Material.Plastic end end end function W.new(w,Z)local d=setmetatable({},{__index=W})d.rig=Z return d end function W.update(W)local Z=(tick()/3)%1 local d=Color3.fromHSV(Z,.7,1)w(W.rig,d,Enum.Material.Neon)end function W.destroy(W)w(W.rig,nil,nil)W.rig=nil end return W
-- object based rainbow renderer, default renderer for rainbow.
local RainbowMaterialRenderer = {}

local function applyMaterialToRig(rig,color,material)
    for _,instance in pairs(rig:GetChildren()) do
        if instance:IsA("BasePart") then
            instance.Color = color or BrickColor.new("White").Color
            instance.Material = material or Enum.Material.Plastic
        end
    end
end

function RainbowMaterialRenderer.new(assetId,rig)
    local self = setmetatable({},{__index = RainbowMaterialRenderer})
    self.rig = rig

    return self
end

function RainbowMaterialRenderer:update()
    local t = (tick()/3)%(1)
    local tickColor = Color3.fromHSV(t,0.7,1)
    applyMaterialToRig(self.rig,tickColor, Enum.Material.Neon)
end

function RainbowMaterialRenderer:destroy()
    applyMaterialToRig(self.rig, nil, nil)
    self.rig = nil
end

return RainbowMaterialRenderer