ViewportFrames Question

ok so currently im using viewport frames for a avatar changer system, however Im struggling to work out how I can lock the position of the frame so the image always looks like this


no matter where my camera is, any solutions?

1 Like

Do you mean where the hair is in your posted image?

If you mean the GUI position of the viewport showing the hair, you can do something like:

.Position = {0, 20}, {0, -50}

… to be 20 pixels (0, -50) from the bottom, and 20 pixels from the left, meaning bottom left corner.

Or {0.1, 0}, {0.9, 0} to use a scalar (dynamic) position regardless of the parent frame size.

Can you offer a more specific description of what you want to achieve, and/or some images with doodles on them showing good vs bad positions?

Frames have positions, Viewportframes have positions, cameras have positions, GUI objects have positions.

In the image you show which position are you trying to always keep?

When and why do you think the position will change? After all, you already show it being in this position.

1 Like

What I need is to be able to get a position of the object using my camerra then locking the positions in the frame

I think I know what you mean. So you put the camera for the object as your current camera, but you want to lock it. ViewportFrame Release That article explains what Viewports are and how to lock a camera in a specific place.
local vf =“ViewportFrame”, script.Parent)
vf.Size =, 0, 0.5, 0)
vf.Position =, 0, 0.25, 0)
vf.BackgroundColor3 =, 1, 1)

local part ="Part", vf) --replaceable with you part
part.Position =, 0, 0)

local camera ="Camera", vf)
vf.CurrentCamera = camera

local cameraPosition =, 3, 3)

camera.CFrame =, part.Position)
That script gets the object and puts the camera in the position. The camera position can be adjusted to get the position you want. I hope this helped :slight_smile:

1 Like

so how would I do this from in studio?

You would make a regular script and put it in the frame or gui where the viewport is.