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

Camera manipulation help?

Asked by 10 years ago

Okay, so the script is local and is in the StarterGui. Here is the script:

script.Parent.Text = "Spectate"
script.Parent.AutoButtonColor = false
function onClick()
    local target = workspace.CameraPart
    if script.Parent.Text == "Spectate" then
        script.Parent.Text = "Stop Spectating"
        local camera = workspace.CurrentCamera
        camera.CameraType = Enum.CameraType.Scriptable
        camera.CameraSubject = target
        local angle = 0

        while wait() do
            camera.CoordinateFrame = CFrame.new(target.Position)  --Start at the position of the part
                                        * CFrame.Angles(0, angle, 0) --Rotate by the angle
                                        * CFrame.new(0, 0, 5)       --Move the camera backwards 5 units
                    angle = angle + math.rad(1)
                end
    else
        script.Parent.Text = "Spectate"
        game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
        game.Workspace.CurrentCamera.CameraType = "Custom"
    end
end
script.Parent.MouseButton1Down:connect(onClick)

It's supposed to be a spectate script, but after you spectate, you can't rotate the camera anymore. Help please. (I'm new at Camera Manipulation, and part of it straight from wiki)

Answer this question