Does it work sometimes or not al all? It is common if it fails sometimes but there is a problem if it will never focus.
If you don't have enough contrast in your shot, even if it is properly lighted, it may not focus. There is no issue here as that is just the limit of the cameras ability.
Go outside and try on a well lighted day and lots of vertical contrast lines. Make sure the lens is on AF and the camera on P or the green square. Does it AF now?
Remove the lens and reinstall it. If it still doen't work check the contacts between the lens and body. There are what are called pogo pins in the body. If they are stuck then the electrical connection between the lens and body might be bad. Be careful when doing this becasue the intenals of the camera will be exposed. Try not to drop or get dirt in it. You can check them by gently pressing on them. They should depress the spring back up.
One question, will the lens focus manually? Just wondering.