Retaking Classes at Different School for Transfer

I have received an F in one of my classes this year and I am trying to transfer schools. I am going to take the same class at a local community college and most likely get a much better grade. When I’m done with that class, even though it was taken at a different school, does the F from that class go away from the school I took it at the first time? Will that F stay on my transcript? And if so, will it not look bad if I make it up with a much better grade?
Thanks for the help!

You will have an F on the transcript from College 1, and a different grade in a similar course on the transcript from College 2. What College 3 makes of the two grades and the two transcripts is up to College 3.