To run code while letting the main script continue, you can use threading, which on roblox, can be incorporated by developers mainly though coroutines as others have mentioned.
However, I think a much more efficient option in this case would be to use roblox’s built in service Debris. It allows roblox to handle objects that need to be destroyed after a certain amount of time, without holding up your main script at all.
Example:
Debris = game:GetService("Debris")
Debris:AddItem(Bullet, 5) --bullet will be destroyed in 5 seconds