You didn't say if this is in a ceiling box or a switch box so Ill take it as if this is in a ceiling box. The whites are your neutrals and the blacks should be power passing thru so connect white to the whites and the black from fixture to red, and see if works off switch , if doesn't send me a message and Ill help you figure it out