Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make another camera that rotates the same as the CurrentCamera?

Asked by 4 years ago
Edited 4 years ago

I created a camera for a ViewportFrame and I was hoping that I could have my ViewportFrame camera's rotation sync with the Workspace's camera, but keep it's position the same. How could I do this? Here's the code:

01local frame = script.Parent
02local player = game.Players.LocalPlayer
03local part = frame.Part
04local questGoal = game.Workspace.QuestGoal
05local workspaceCamera = game.Workspace.Camera
06local camera = Instance.new("Camera")
07-- Below is the Camera properties being set
08camera.CFrame = CFrame.new(Vector3.new(-2, 0, -2), part.Position)
09camera.CameraSubject = part
10camera.Parent = frame
11frame.CurrentCamera = camera
12 
13while true do
14    part.CFrame = CFrame.new(Vector3.new(0, 0, 0), questGoal.Position)
15    wait()
16end

Answer this question