Too many wires coming out of ceiling fixture
If your wiring is standard and NEC-compliant: 

One cable is the feed, one is te line gouing to next lamp, the third (that has 4 wires: red, black, white and copper) is the wire from the switch.

Just connect whites together (the 4 from wall + one from the fixture), the blacks coming (from wall) together, and the black from the fixture to the red (from the switch)

If you're not sure / don't know how to check, hire an electrician to have it fixed