I have created a script that, when a button is clicked, checks if a player’s cam (string value) is a certain value, and if it is, then it changes the player’s camera to a position where the camera looks down on the player. The variable “cameraPart” is the part that is above the player. The variable “camera” is just the CurrentCamera. Though the code works, I want to either tween it or LERP it, because right now, it just snaps from first person to third person, and I want it to be smoother. Here is the code:
if player.cam.Value == "f" and char:FindFirstChild("HumanoidRootPart") then
camera.CameraSubject = cameraPart
cameraPart.CFrame = CFrame.new(char.HumanoidRootPart.Position + Vector3.new(-7, camHeight, 0))
char.Humanoid.WalkSpeed = 0
char.Humanoid.JumpPower = 0
camera.CFrame = CFrame.new(Vector3.new(0, 100, 0), Vector3.new(0, 0, 0))
camera.FieldOfView = 30
end
You should probably just use tweening, as it supports more customisation over the style.
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Circular, Enum.EasingDirection.In) -- You can change these according to your needs
local tween = game:GetService("TweenService"):Create(camera, tweenInfo, {CFrame = CFrameYouWantToSet})
tween:Play()