local L=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local p=L:WaitForChild("\099\111\109\109\111\110")local A=require(p:WaitForChild("\065\115\115\101\116\115"))local C={}local function K(L,p)local A=L:FindFirstChild("\084\111\114\115\111")if A then local L=A:FindFirstChild("\068\101\099\097\108")if L then L.Texture=p or"\114\098\120\097\115\115\101\116\105\100\058\047\047\049\048\050\051\049\050\051\048\049"end end end function C.new(L,p)local f=setmetatable({},{__index=C})f.rig=p f.assetId=L local h=A.byId[L]if h then K(p,h.metadata.image)end return f end function C.update(L) end function C.destroy(L)K(L.rig,nil)L.rig=nil end return C
-- object based faces renderer, default renderer for faces.

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local common = ReplicatedStorage:WaitForChild("common")
local Assets = require(common:WaitForChild("Assets"))

local FaceRenderer = {}

local function applyFaceToRig(rig,image)
    local torso = rig:FindFirstChild("Torso")
    if torso then
        local face = torso:FindFirstChild("Decal")
        if face then
            face.Texture = image or "rbxassetid://102312301"
        end
    end
end

function FaceRenderer.new(assetId,rig)
    local self = setmetatable({},{__index = FaceRenderer})
    self.rig = rig
    self.assetId = assetId
    local faceAsset = Assets.byId[assetId]
    if faceAsset then
        applyFaceToRig(rig,faceAsset.metadata.image)
    end

    return self
end

function FaceRenderer:update()
    -- nothing needed here
end

function FaceRenderer:destroy()
    applyFaceToRig(self.rig, nil)
    self.rig = nil
end

return FaceRenderer