First of all, hi.
I am trying to make something like a profile photo for my game.
I would use the default thumbnail roblox’s system (Enum.ThumbnailType.AvatarBust
), but it is just a label and i want it to be able to play animations.
I tried it with WiewportFrames, this is the code:
local function findDescendantOfClass(s, cl)
for _, v in pairs(s:getDescendants()) do
if v.ClassName == cl then
return v
end
end
return nil
end
local function findDescendant(self, class)
self = self or script
local response = findDescendantOfClass(self, class)
while not response do
response = findDescendantOfClass(self, class)
self.DescendantAdded:Wait()
end
return response
end
local view: ViewportFrame = findDescendant(script.Parent, 'ViewportFrame')
local camera = Instance.new 'Camera'
camera.Parent = view
view.CurrentCamera = camera
local player = game:GetService 'Players'.LocalPlayer
local function characterLoaded(character)
local pastclone = view:FindFirstChildOfClass 'Model'
if pastclone then
pastclone:Destroy()
end
if not character.Archivable then
character.Archivable = true
end
local clone = character:Clone()
clone.Parent = view
local cf = clone:getPivot()
camera.Focus = cf
camera.CFrame = cf + Vector3.new(0, 0, -2)
end
player.CharacterAppearanceLoaded:connect(characterLoaded)
but I just added it to the post for you to understand what I’m trying to make; that code is working weird.