Okay so I've been working on a camera roll script that will smoothly roll the camera kinda like tweening. I've gotten it to a certain extent but now, I have no idea what's glitching it. If you copy and paste the script below into a local script in studio, and then test it, it'll work exactly how it is working for me. I don't know how to fix that glitch so someone please help :(
wait(1)
local player = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera
local mouse = player:GetMouse()
local char = player.Character
local RS = game:GetService('RunService')
local target = char:WaitForChild("Head")
cam.CameraType = Enum.CameraType.Scriptable
cam.CameraSubject = target
game:GetService('RunService').RenderStepped:connect(function()
cam.CoordinateFrame = CFrame.new(target.Position) + Vector3.new(0,0, 10)
end)
local v = 0
local Leaning = false
function LeanCam(t,s)
RS.RenderStepped:wait()
while Leaning do
wait()
v = v + (t - v) * s
cam:SetRoll(v)
end
wait(0.15)
end
mouse.KeyDown:connect(function(Key)
if Key == "q" then
Leaning = true
LeanCam(-1,0.15)
Leaning = false
end
end)
mouse.KeyUp:connect(function(Key)
if Key == "q" then
Leaning = true
LeanCam(1,0.15)
Leaning = false
end
end)

1 comment
I haven't worked too much with cameras, so this is a bit of a guess, but I believe instead of adding a Vector3 on line 14, you should be multiplying a CFrame.new value. If that doesn't work, I would have to test this myself and experiment around with it. Good Luck!