The heat can cause pickguards to curl, and it can damage wood and glue joints. The cold can cause cracking of plastic parts and possible finish checking. Unless your attic has heat and air conditioning, avoid putting instruments there. Humidity and moisture are generally bad for your guitar. It causes the wood to swell and grow mildew.
Many houses have a basement used for storage.
Some basements can reach humidity levels of 90 percent or higher during the summer, whcih can play havoc with your guitars and amplifiers. While basements are typically damp, especially in summer, some can become quite dry in winter because the heating system is often located there. Any forced air system will generate enough heat and dryness to lower the humidity range into the 70 percent area, which is bad for guitars. Unless you can control the temperature and humidity in your basement, best not to keep your guitars there. The third danger is light .