AF-S NIKKOR 50mm f/1.8G

Bought a AF-S NIKKOR 50mm f/1.8G lens today for my Nikon D40… Takes great pictures however i'm unsure of what camera setting i need my camera on and also why it won't take some photographs?
help
Added (1). I don't want answers lke "revise photography" etc! I know that. This is just a quick question!

The problem is that you clearly do not know how to use a DSLR camera properly. Read the instructions that came with your camera.

Study photography more

Well actually you DO need to learn about photography if you are asking what settings you need - if you are referring to exposure settings then that depends on what type of photo you are taking (eg do you need to blur/freeze motion? Do you need a deep/shallow depth of field?) and how much light there's (which the camera meter will tell you in manual mode).
If you want a shallow depth of field with that lens, then open up the aperture - f1.8 is the widest it will go of course.
It will have a minimum focusing distance and its not a macro lens, so it won't close focus - if the picture isn't being taken it may be that you are too close and the lens can't focus. That's the most obvious reason I can think of. The autofocus will also get confused if you are trying to focus on something with not enough tonal contrast, or there's not enough light. In those cases you will have to switch to manual focus.

First, your AF-S 50mm f1.8G lens has a minimum close-focusing distance of 1'-6''. Get any closer and the lens can't focus and you can't take a picture.
Second, all lenses need a certain amount of light in order to focus. If there's too little light the lens can't focus and you can't take a picture.
In the first example all you need to do is back up a little so your subject is at least 1'-6'' or more away from the lens.
In the second example you'll either need to add additional light or find a better lit subject, focus on it, lock the focus and then recompose and take the picture of your original subject. You can also try manually focusing the lens.
Asking "… What camera setting I need my camera on… " is impossible to answer. Are you outdoors? Is it sunny? Cloudy? Nighttime? Are you indoors? Are you using available light only or the camera's flash? Are you shooting action? Do you want to freeze the action or allow a little blur to show motion? Are you shooting a landscape where you'll want maximum depth of field? Are you shooting a portrait where you'll want minimum depth of field?
In my opinion you'd be wise to take a couple of introductory photography classes. Spending time at these sites will also help you:
http://www.digital-photography-school.com
http://www.illustratedphotography.com
http://www.kamerasimulator.se/eng/?page_id=2
These books will help you:
'Understanding Exposure', 'Understanding Shutter Speed' and 'Understanding Photography Field Guide' all by Bryan Peterson.
Its also advisable to again read & study the Owner's Manual for your camera.