BodyGyro not rotating

I’ve been trying to figure this out for an hour now and I haven’t found anything on the dev forum to help me. For some reason my body gyro script is not rotating the player as it should and everything else in my script is working perfectly.

local bodygyro = Instance.new("BodyGyro",Char.HumanoidRootPart)
	bodygyro.MaxTorque = Vector3.new(400000,400000,400000)
	bodygyro.D = 80
	repeat game:GetService("RunService").Heartbeat:Wait()
		local cp = Char.HumanoidRootPart.Position
		local vp = hit.CastedBy.Value.Position
		center.Position = Vector3.new(module.ThreeDMidpoint(cp.X,cp.Y,cp.Z,vp.X,vp.Y,vp.Z))
		bodygyro.CFrame = CFrame.new(Char.HumanoidRootPart.Position,center.Position)
	until not Char:FindFirstChild("Wand") or Char.Humanoid.Health == 0 

If anyone can help it would be very appreciated!