How to i make an animatable profile photo in-game?

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.

Try using a ViewportFrame. You can animate a 3d object in it.

that is what I was using, sorry, I wrote wireframe.

The problem with that is that i can’t figure out how to make it

Try this (I’m not very good with viewportframes, sorry).

local Object = thing:Clone()
Object.parent = ViewportFrame
local Cam = Instance.new("Camera",ViewportFrame)
Cam.CameraType = Enum.CameraType.Scriptable

You should be able to figure out the rest (animations, camera positioning (Camera.CFrame), etc.) by yourself.

1 Like