Drawing Playermodel to HUD?

Hey, I found a code from a video earlier that allowed you to draw your playermodel on the HUD of the users screen.



local function DrawPlayerModel()
       
        PlayerModel = vgui.Create("DModelPanel")
        function PlayerModel:LayoutEntity( Entity ) return end
        PlayerModel:SetModel( LocalPlayer():GetModel() )
        PlayerModel:SetPos(0, ScrH() - 200)
        PlayerModel:SetSize(175,200)
        PlayerModel:SetCamPos(Vector( 20, 0, 65 ))
        PlayerModel:SetLookAt(Vector( 0, 0, 65 ))
       
        timer.Create( "UpdatePlayerModel", 0.5, 0, function()
                if LocalPlayer():GetModel() != PlayerModel.Entity:GetModel() then
                        PlayerModel:Remove()
                        PlayerModel = vgui.Create("DModelPanel")
                        function PlayerModel:LayoutEntity( Entity ) return end         
                        PlayerModel:SetModel( LocalPlayer():GetModel())
                        PlayerModel:SetPos(0, ScrH() - 200)
                        PlayerModel:SetSize(175,200)
                        PlayerModel:SetCamPos(Vector( 20, 0, 65 ))
                        PlayerModel:SetLookAt(Vector( 0, 0, 65 ))
                end
        end)
       
end
hook.Add("InitPostEntity", "DrawPlayerModel", DrawPlayerModel)


The only problem was that it didn’t update the color or hats from pointshop etc.
I was just wondering if anyone knew a solution to this because I’m completely clueless on how to do it.
Thank you :3

You’d need to extend DModelPanel to accept more models that just the primary for it to show hats, etc. To change the color, just target either the panel.Entity or panel:GetEntity( ), or in some cases you target the panel and SetColor to color the player.