Electrical Questions? Ask an Electrician Online.
Hi, I'm Mike G and I'll be assisting you. Please tell me the wire colors.
Is the hot black connected to a white wire?
Do you have a 2 wire voltage tester? You need to identify which wire's go to the switch.
OK, connect all the blacks together then test each white to ground while flipping the switch. The one that shows hot then not is the switch white. You then disconnect that wife's paired black and connect that white to the hot black and the other black. The remaining whites connect together with the fixture white and the single black connects to the fixture black. That white wire connected to the blacks should be marked with black tape or marker to identify it goes to a switch as a hot.
See the attachment