Welcome to NikonForums.com
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Just a guess but if everything works with other lens this lens may have dirty contacts or something worse. Using a soft eraser gently clean the contacts on the back of the lens. Don't over do it or scrub real hard.
I'm just guessing, but if your not in the photo when your setting up the shot its focusing on the background. When you step in to the frame the focus won't change, it's still on the background.