Camera system help - Tween

I need some help with my script for a camera system. The attached video showcases what the script currently does. I will attach another video showing a more accurate representation of what I’m after by altering the code slightly, however my desired result is a blend of the two which I will explain.

The video above shows the result of the current code which is as follows:

-- Services
local uis = game:GetService("UserInputService")
local ts = game:GetService("TweenService")
local rs = game:GetService("RunService")
local context = game:GetService("ContextActionService")

-- Player & Character
local plr = game:GetService("Players").LocalPlayer
local c = plr.Character or plr.CharacterAdded:Wait()

-- Other
local Camera = game:GetService("Workspace").CurrentCamera
local mouse = plr:GetMouse()

-- Values
local xAngle = 0
local yAngle = 0
local cameraPos =, -1, 5)

local isWalking = true

Camera.CameraType = Enum.CameraType.Scriptable

-- Function to update camera
local function updateCamera()
    local rootPart = c:FindFirstChild("HumanoidRootPart")
    uis.MouseBehavior = Enum.MouseBehavior.LockCenter

    if c and rootPart then
        local startCFrame = +, 2, 0))) * CFrame.Angles(0, math.rad(xAngle), 0) * CFrame.Angles(math.rad(yAngle), 0, 0)
        local targetCameraPos = isWalking and, cameraPos.Y, cameraPos.Z + 0.5) or cameraPos

        local cameraCFrame = startCFrame + startCFrame:VectorToWorldSpace(targetCameraPos)
        local cameraFocus = startCFrame + startCFrame:VectorToWorldSpace(, targetCameraPos.Y, -50000))
        -- No Tween version
        --Camera.CFrame =,cameraFocus.p)
        -- Tween the camera position
        ts:Create(Camera,, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame =, cameraFocus.p)}):Play()

-- Bind action to handle mouse movement
context:BindAction("CameraMovement", function(_, _, input)
    xAngle = xAngle - input.Delta.x * 0.4
    yAngle = math.clamp(yAngle - input.Delta.y * 0.4, -80, 80)
end, false, Enum.UserInputType.MouseMovement)

-- Connect to RenderStepped to update camera

-- Connect to MoveDirection property to determine if the character is walking
    if c.Humanoid.MoveDirection.Magnitude > 0 then
        isWalking = true
        isWalking = false

This next video shows the closer representation of what I’m after by swapping out the tween line in the code above with the “no tween version”:

What I’m looking for is very similar to this video but with a few more subtle differences. As you can see from the video above, when the player begins moving, the camera is smoothly tweened backwards and back to its “original position” when the player stops moving. I want to create this effect but with the general camera movement that is shown in the second video

And now that i view it, if theres a way to make it less janky, as you can see in the second video it seems to “stutter” that would also be greatly appreciated

I’m not good at math or cframes but have you try to interpolate between camera cframe and new cframe

camera.CFrame = camera.CFrame:lerp(newCframe, alpha) --in your case alpha is 0.5

I just tried this, and it sort of worked? but i believe i get the same results by making the tween happen quicker as well. The issue with this is that the “zoom out” happened too quickly, so I decreased the alpha, however, doing this gave me the same results as the first video where the camera feels more like a cinematic camera and rotating the camera too quickly would seemingly cause it to zoom in as you could see in that video.

I do believe I know why this is the case, I just don’t know how to work around it.