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

Camera Not Moving?

Asked by 8 years ago

I have a camera recoil script and everything, but the camera doesn't seem to be moving?

local recoil = 0.0075
local kick = 0.025

function CameraRecoil()
    local spread = {recoil, -recoil}
    local i = spread[math.random(1,#spread)]
    local Camera_rot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
    local Camera_scroll = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
    local ncf = CFrame.new(Camera.Focus.p)*Camera_rot*CFrame.fromEulerAnglesXYZ(kick, 0, 0)
    Camera.CoordinateFrame = ncf*CFrame.new(i, 0, Camera_scroll)
    coroutine.resume(coroutine.create(function()
    for i = 1, 5 do
    wait()
    local Camera_rot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
    local Camera_scroll = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
    local ncf = CFrame.new(Camera.Focus.p)*Camera_rot*CFrame.fromEulerAnglesXYZ(0, 0, 0)
    Camera.CoordinateFrame = ncf*CFrame.new(0, 0, Camera_scroll)
    end
    end))
end
0
I noticed you're using Camera.Focus.p, etc. Is the CameraType set to "Scriptable"? XAXA 1569 — 8y
0
Yeah ScriptingCon 52 — 8y
0
Wait no, it's on custom ScriptingCon 52 — 8y
0
Camera manipulation cannot be done if CameraType is set to Custom. Set it to Scriptable. That being said, Camera.Focus.p will not work if CameraType is set to Scriptable. XAXA 1569 — 8y
0
It was working perfectly fine yesterday? ScriptingCon 52 — 8y

Answer this question