Hello all, so today I am trying to match up the ViewportFrame camera with the main camera by setting it's CFrame. I have code attached. The script is the child of the ViewportFrame.
wait(3) while 2+2==4 do local viewportFrame = script.Parent local viewportCamera = Instance.new("Camera") viewportFrame.CurrentCamera = viewportCamera viewportCamera.Parent = viewportFrame local camera = workspace.CurrentCamera local cameraCFrame = camera.CFrame local viewCFrame = viewportCamera:GetRenderCFrame() viewportCamera.CFrame = CFrame.new(Vector3.new(cameraCFrame)) print(viewCFrame) wait(0.1) end
Thank you! Any help is appreciated.
It's actually quite simple! You just need to set the ViewportFrame's CurrentCamera to the current camera in workspace with a LocalScript.
script.Parent.CurrentCamera = workspace.CurrentCamera --Set the CurrentCamera of the ViewportFrame as the CurrentCamera in workspace