How do I make a while loop that runs in the background?

Psst, I think you mean this other post.