How to move camera when player moves left and right

If you have seen that games like SCP-3008 or many others, you can notice when you move left or right, the camera rotates smoothly to that side, how to do this?

You need to use turn current camera type to Scriptable.
Detect if player press A or D, and when pressed, rotate camera CFrame using tweens.

1 Like
local Run = game:GetService("RunService")
local Tweens = game:GetService("TweenService")

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")

local Camera = workspace.CurrentCamera

local function ManipCamera(Delta)
	Camera.CameraType = Enum.CameraType.Scriptable
	local Tween = Tweens:Create(Camera, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(HRP.Position) * CFrame.Angles(0, math.rad(HRP.Orientation.Y), 0) * CFrame.new(0, 4, 8)})
	Tween:Play()
end

Run.RenderStepped:Connect(ManipCamera)
1 Like