I was just playing around and making a camera system that follows the player, but for some reason I just can’t figure out how to make the field of view camera increase as the player gets closer but decrease when they get further.
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local character = localPlayer.Character or localPlayer.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local cameraView = Workspace:WaitForChild("CameraView")
local currentCamera = Workspace.CurrentCamera
task.wait(5)
currentCamera.CameraType = Enum.CameraType.Scriptable
currentCamera.CFrame = CFrame.lookAt(cameraView.Position, humanoidRootPart.Position)
local function followPlayer(deltaTimeSim)
TweenService:Create(currentCamera, TweenInfo.new(0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {FieldOfView = (cameraView.Position + humanoidRootPart.Position).Magnitude / 5}):Play()
TweenService:Create(currentCamera, TweenInfo.new(0.3, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {CFrame = CFrame.lookAt(cameraView.Position, humanoidRootPart.Position)}):Play()
end
RunService.PreSimulation:Connect(followPlayer)