So my camera script works completely fine untill i die, the camera stays in the same place and doesnt move eg
local plr = game.Players.LocalPlayer local mouse = plr:GetMouse() repeat wait() until plr.Character local char = plr.Character local cam = game.Workspace.CurrentCamera local zoom = 100 cam.FieldOfView = 15 cam.CameraType = Enum.CameraType.Scriptable mouse.WheelForward:connect(function() if zoom > 70 then zoom = zoom - 2 else zoom = 80 end end) mouse.WheelBackward:connect(function() if zoom < 100 then zoom = zoom + 2 else zoom = 100 end end) while true do game["Run Service"].RenderStepped:wait() if char then if char:FindFirstChild("Head") then cam.CoordinateFrame = CFrame.new(Vector3.new(char.Head.Position.X+zoom,char.Head.Position.Y+zoom,char.Head.Position.Z+zoom),char.Head.Position) end end end
It looks like the problem is probably the script continues to refer to a camera and character that has changed. On death, the camera and character are deleted and respawned, but the variables dont look like they reflect that change. So all you should need to do is add:
plr.CharacterAdded:Connect(function() repeat wait() until plr.Character char = plr.Character cam = workspace.CurrentCamera end)
before the while true do loop.