Viewport Frames not working when cloning

I am cloning a Viewport Frame from server storage to a ScrollingFrame. The Objects inside the VP work when I move them manually inside the ScrollingFrame in my explorer. However, when I clone them and Parent them to the ScrollingFrame, the Objects (Images) dont appear inside. I am cloning the whole TextButton (with its descendants). Thank you
Explorer:
image

Camera
image

Viewport Frame

What it looks like

What it shoud look like

I can show the cloning script, but I dont think its necessary since its not an issue with script.

1 Like

I think you may need to reset the camera CFrame when moving it over and make sure it is set to a viewable distance relative to the subject of the viewport.

Try testing this out by manually copying the CFrame of the camera and then setting it to the CFrame in your script. If this works, we can discuss ways to do this automatically.

I don’t understand what you mean by copying the CFrame part. Btw, when I save the game, the camera inside the Viewport Frame disappears, is it normal?

This is after I saved the game and reopened studio
image

Check to make sure the CurrentCamera of the cloned ViewportFrame is set. The Clone method may not correctly handle this relative object reference automatically.

Note:
This page says: “The Camera object will not replicate so the ViewportFrame.CurrentCamera won’t replicate either… If you want to change the client’s Camera, you have to create a new Camera using a LocalScript at runtime.”

Since you are cloning the ViewportFrame from ServerStorage, when cloned and parented to a client, the existing Camera object (regardless of whether it is set to the ViewportFrame’s CurrentCamera) will not replicate.

Storing the template ViewportFrame in ReplicatedStorage may resolve this issue, but if not, creating the ViewportFrame at runtime via a LocalScript (including creating a Camera and setting it as the ViewportFrame’s CurrentCamera) will resolve this issue.