First of all, go easy on yourself! No need to instance in the Viewport Frame at runtime - build it in Studio! It’ll end up looking better in terms of UI design. If you need it to hide/show, change its Visible property, or clone it from Replicated Storage.
Also, your character is incredibly small because the viewport camera is too far away. Consider offsetting it from the character, like so:
local BACKING = 5
local base = character:GetPrimaryPartCFrame()
local pos = base.Position-base.LookVector*BACKING
viewportCamera.CFrame = CFrame.new(pos,base.Position)
Experiment with the BACKING constant until you reach the desired magnification. Hope it works!
I’m aware of the upper bust thumbnail API, but to mimic this behaviour on a viewport frame, you’d need to centre on the head rather than the default primary part (HumanoidRootPart).
Swap the code I gave you for this:
local BACKING = 5
local base = character.Head.CFrame
local pos = base.Position+base.LookVector*BACKING
viewportCamera.CFrame = CFrame.new(pos,base.Position)
In short, change the second line to the Head’s CFrame. I also highly recommend you to decrease BACKING and decrease the viewport camera’s Field of View (property).
Great work! I’d have to argue, especially for non-viewport scenarios, my method is more reliable. The same result can be gotten from changing the BACKING constant to 2 - that basically controls the zoom level.
Thanks for the information! Changed the code as you said.
I am new to Viewport Frames as I just found about them few days ago. I am going to practice making things with them in the future!
Sure! With characters, what you’re doing is spot-on… but just remember when it’s best to take a picture of your items (particularly products) manually, so you can make them look glamarous in Photoshop or whatnot.