Drag Detector in VPF

Hello, I would like to add the player’s character on their profile page in my game. This is simple, but how would I make them able to rotate the character in the frame?

Something similar to this is when you go on [this page] (Sombrero de fieltro azul verdoso destellante - Roblox) and you click on the “Wear” button. You can drag the character around.

Any help is appreciated!

You could first cover the viewport frame in a TextButton. Then do this:

-- Local script in StarterGui under the viewport
local viewport = script.Parent\
local uis = game:GetService('UserInputService')
local cam = viewport.CurrentCamera
local button = script.Parent.TextButton -- Assuming text button is a child of the viewport
local isdragging
button.Activated:Connect(function()
   isdragging = true
end)
button.Deactivated:Connect(function()
   isdragging = false
end)
uis.InputChanged:Connect(function(i,p)
   if p or i.UserInputType ~= Enum.UserInputType.MouseMovement or not isdragging then return end
   local delta = i.Delta
   cam.CFrame *= CFrame.new(Vector3.new(),-delta)
end)

This is just a prototype, it may not do the math properly