bind it to a renderstep loop instead of a while wait() do loop:
local RunService = game:GetService("RunService")
local function onLeverPullAnimation()
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
RunService:BindToRenderStep("CameraUpdate", Enum.RenderPriority.Camera.Value + 3, function()
workspace.CurrentCamera.CFrame = humanoid.Parent.Head.CFrame
end)
end
Also make sure you are running this code on the client, things that need to run in a constant loop like camera transformations should always be done the client.