Hi I have a Canon T6i with the lens 18-55mm. I have only had the camera for 2 days since I bought it and when I turned it on today, the camera was completely out focus. I've tried everything on the forums. I've tried putting it on AF mode and all that. Nothing works. When the I'm trying to take a picture and the Flash is on, it makes a clicking sound and the lights are flickering. I don't know what the issue is here. Please help.
Assuming you have the "STM" version of the lens, it's a focus-by-wire lens. Make sure the AF/MF switch (on the lens barrel) is in the "AF" position.
The camera can't focus unless there is enough light. It will struggle in a dark room.
You can manually focus but you have to wake-up the focus electroncis (usually by half-pressing the shutter button) to do this.
The minimum focus distance is about 10" for that lens (assuming the STM version ... which is what comes with a T6i these days when you buy the camera body+lens kit.)
Your FIRST photo below looks like it did focus on a bit of the plaid... but keep in mind that there's another issue called "depth of field". This is the notion that there's a range at which things will appear to be more or less in acceptable focus.
For example... if you focus on a subject precisely 10' away, you'll probably also notice that things only 9' away also look like they are reasonably focus... and even 11' away probably seems reasonably focused... but things 2 or 3' away seem very much out of focus ... as do things 50' away. That "range" of distances where things appear to be in acceptable focus is the "field" and the distance from front to back is the "depth". You'll see the term "depth of field" or the abbreviation "DoF" from time to time.
Anyway, I bring this up because when things are VERY close to the camera (near minimum focus distance) the depth of field is naturally shallower than it is when things are far away. Close subjects may offer a depth of field of just an inch or two. Distance subjects may have depth of fields of many feet or even infinity.
It turns out there are several factors that influence what the type of field actually is (it can be calculated mathematically ... so there are apps and look-up tables that will tell you what it should be for any given camera, lens focal length, lens focal ratio, and subject distance.
I bring this up because it looks like the camera may be working in that first image... but you have a shallow depth of field. That may be tricking you into thinking that it's not working.
The STM lenses are nearly completely silent when they focus.
To test... give the camaera optimal conditions. Take the camera outside in the middle of the day (nice bright light) and focus on things that are close & far (and well lit).
Half-press the shutter (use a mode like "Program" or full Auto) to focus on something. Move to a subject which is a different distance from the camera but you MUST release and half-press the shutter button or it wont re-focus (in "One Shot" focus mode ... which is the default... it moves the lens focus UNTIL it achieves focus and then stops. If the subject distance changes it will NOT update focus again unless you release and re-press the shutter button half-way down.)
Hopefully your camera is in good working order and you'll be able to test it out.
If it STILL does not work, let us know or phone Canon tech support. Since it's only 2 days old, you should be able to exchange it.
BTW, the focus system in "live view" mode is completely different than the focus system when using the viewfinder (looking through the camera). Normally you will want to use the viewfinder (it's much faster and has several other advantages.)