Please just go look up multi-threading. This topic has been solved. After you look up multi-threading, if you run into issues, make a new topic.
I’ll even give you a free starting point: