local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Camera = workspace.CurrentCamera
local LastCameraCFrame = nil
local TweenPlaying = false
RunService.RenderStepped:Connect(function(DeltaTime)
local CurrentCFrameAngles = {Camera.CFrame:ToEulerAnglesXYZ()}
if LastCameraCFrame then
local LastCFrameAngles = {LastCameraCFrame:ToEulerAnglesXYZ()}
local Calculations = CurrentCFrameAngles[2] - LastCFrameAngles[2]
if not TweenPlaying then
TweenPlaying = true
local Tween = TweenService:Create(
Camera,
TweenInfo.new(DeltaTime / 4, Enum.EasingStyle.Circular),
{["CFrame"] = Camera.CFrame * CFrame.Angles(0, 0, Calculations / 1.5)}
)
Tween.Completed:Once(function()
TweenPlaying = false
end)
Tween:Play()
end
end
LastCameraCFrame = Camera.CFrame
end)