Camera randomly dissapearing from ViewportFrame?

Hello developers. I have encountered a strange error where this Camera dissapears from a ViewportFrame upon launching the game, and i am wondering why this is occuring. Here are some images of the explorer layout (for clarification)

before launching:
devforumimage1

after launching:
devforumimage2

It would be appreciated if somebody could explain why this is happening or what i may be doing wrong. Thank you in advance.

4 Likes

The camera instance is deleted on play test and when studio is reopened. The Cameras data is stored in the viewport however so you don’t need to worry about it not being there. If you want to edit the Cameras CFrame during runtime you will need to create a camera instance within a local script and assign it to the viewport.

1 Like

Can’t you add a script in it that loads a camera in it?

local ViewPort = Instance.new("Camera", script.Parent)
ViewPort.Name = "ViewCamera"
-- Other configurations here.
3 Likes

I could, but i was just wondering why exactly it had seemingly deleted the camera upon launch, as it was creating an error in the output saying that it didn’t exist, making me assume that it was entirely gone. But i’ll try that method instead. Thank you.

It most likely is deleting because of A: A corrupted file/part of the game. (The camera.) Or B: As @Tom_atoes said, it is deleted on play test.

Do all the ViewportFrame’s children get hidden during runtime or just the camera?
I have coded it so the player’s character model gets parented to the ViewportFrame, but it is not showing up in the explorer.

It is just the camera as far as I am aware. All camera instances that are not the default Camera are destroyed on playtest.

Should i make another post for this new error or try and solve it here?

Cameras don’t replicate. You’ll need to make the camera again from the client.

1 Like
local camera = Instance.new("Camera")
camera.Name = "ViewCamera"
camera.Parent = --set parent instance here

Create a new “Camera” instance dynamically.

1 Like