I would like to make the camera move smoothly like in British Rail. The script I used unfortunately does not work on VehicleSeats since the camera sensitivity drops significantly and it is difficult to move the camera. Here is the script I used:
local run = game:GetService'RunService'
local uis = game:GetService'UserInputService'
local cam = workspace.Camera
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local rad = 180/math.pi
local clamp = math.clamp
local current = Vector2.zero
local targetX, targetY = 0, 0
local speed = 8 -- Speed of the animation
local sensitivity = 1 -- Sensitivity of the rotation
local releaseSpeed = 0.5 -- How much speed remains when you release
uis.MouseDeltaSensitivity = 0.01
cam.CameraType = Enum.CameraType.Custom
run:BindToRenderStep("SmoothCam", Enum.RenderPriority.Camera.Value-1, function(dt)
local delta = uis:GetMouseDelta()*sensitivity*100
targetX -= delta.X
targetY = clamp(targetY-delta.Y,-89,89)
current = current:Lerp(Vector2.new(targetX,targetY), dt*speed)
cam.CFrame = CFrame.fromOrientation(current.Y/rad,current.X/rad,0)
end)
mouse.Button2Up:Connect(function()
local new = current:Lerp(Vector2.new(targetX,targetY), releaseSpeed)
targetX = new.X
targetY = new.Y
end)