Script (By myself):
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local cam = game.Workspace.CurrentCamera
local RunService = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local Root = char:WaitForChild("HumanoidRootPart")
local Offset = CFrame.new(0, 3, 10)
local TargetCF = Root.CFrame * Offset
local MousePressed = false
UIS.InputBegan:Connect(function(key, GP)
if GP then return end
if key.UserInputType == Enum.UserInputType.MouseButton2 then
MousePressed = true
cam.CameraType = Enum.CameraType.Custom
end
end)
UIS.InputEnded:Connect(function(key, GP)
if GP then return end
if key.UserInputType == Enum.UserInputType.MouseButton2 then
MousePressed = false
cam.CameraType = Enum.CameraType.Scriptable
end
end)
RunService.RenderStepped:Connect(function()
if MousePressed == false then
TargetCF = TargetCF:Lerp(Root.CFrame * Offset, 0.1)
cam.CFrame = TargetCF
end
end)