I have this script that moves the camera around, it continues working when the player dies but not when the player is reloaded with :LoadCharacter(
--Get service needed for events used in this script
local RunService = game:GetService("RunService")
-- Variables for the camera and player
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
-- Constant variable used to set the camera’s offset from the player
local CAMERA_OFFSET = player.Character:WaitForChild("CameraOffset").Value
camera.CameraType = Enum.CameraType.Scriptable
local debounce = false
local function onRenderStep()
local success , err = pcall(function()
if debounce == false then
debounce = true
if player.Character:FindFirstChild("HumanoidRootPart") then
local CAMERA_OFFSET = player.Character:WaitForChild("CameraOffset").Value
local playerPosition = player.Character.HumanoidRootPart.Position
local cameraPosition = playerPosition + CAMERA_OFFSET
-- make the camera follow the player
camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
camera.CFrame = CFrame.fromMatrix(
cameraPosition,
Vector3.new(1,0,0),
Vector3.new(0,0,-1)
)
end
debounce = false
end
end)
if not success then warn(err) end
end
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)
But why though