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

5 comments

0

I noticed you're using Camera.Focus.p, etc. Is the CameraType set to "Scriptable"?

0

Yeah

0

Wait no, it's on custom

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.

0

It was working perfectly fine yesterday?