-- ClassName: LocalScript

local OFFSET = Vector3.new(-45, 45, 45)
local FIELD_OF_VIEW = 25

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local run = game:GetService("RunService")

camera.FieldOfView = FIELD_OF_VIEW

local function onRenderStep()
  local playerPosition = player.Character.Torso.Position
  local cameraPosition = playerPosition + OFFSET
  camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
end

run:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)

-- ClassName: LocalScript

local OFFSET = Vector3.new(-45, 45, 45)
local FIELD_OF_VIEW = 25

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local run = game:GetService("RunService")

camera.FieldOfView = FIELD_OF_VIEW

local function lookAt(pos)
  local cameraPos = pos + OFFSET
  camera.CoordinateFrame = CFrame.new(cameraPos, pos)
end

local function onRenderStep()
  local character = player.Character
  local primaryPart = character.PrimaryPart

  if character and primaryPart then
    lookAt(primaryPart.Position)
  end
end

run:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)

Fix camera errors when the player dies
Fix camera errors when the player dies

We didn't check to make sure that the character actually exists before
continuing, so when the player drops into the void and their character is
deleted, we got constant errors from RenderStepped. This fixes that.
