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

Custom Camera Type not working - what do I do?

Asked by 6 years ago

I am trying to create a script to move the camera around an object. Everything works fine until I try to give the control of the camera back to the player - I set the camera type to Custom however the camera does not move around the player as it should. Every other camera type (Follow, Track, Attach etc.) will work, just not Custom. What is the problem here.

connection = game:GetService("RunService").Heartbeat:Connect(function()
    if i < 360 then
        camera.CFrame = CFrame.new(target.Position)
                  * CFrame.Angles(0, angle, 0)
                  * CFrame.new(0, 10, 50 + 30 * math.sin(math.rad(i/2)))
        angle = angle + math.rad(0.5)

        i = i + 0.5
    end

    if i >= 360 and i < 420 then
        i = i + 1
    end

    if i >= 420 and i < 480 then
        camera.CFrame = camera.CFrame:lerp(game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.new(0, 2.5, 10), 0.1)
        i = i + 0.5
    end

    if i >= 480 then
        camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
        camera.CameraType = Enum.CameraType.Custom -- every other type works fine

        connection:Disconnect()
    end
end)
0
Hi ik you have a little something if yours going on but, i asked a question about the same as yours in camera manipulation, could you help me on my question, im having trouble getting the camera? Carforlife1 59 — 6y
0
Is this your default CameraScript or a LocalScript that disables CameraScript upon connection? y3_th 176 — 6y
0
? It's an ordinary LocalScript within StarterPlayerScripts NotInventedHere 158 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

I figured it out. The script was called "CameraScript", which means that the default camera control script gets overriden. I solved it by changing the name to something that is not "CameraScript."

Ad

Answer this question