getreg returns the Luau registry table. The registry is a special table which is used internally to store references like threads, functions, and data shared between C and Luau (userdata).
localloop_thread=task.spawn(function()whiletask.wait(1)doprint("I am still running...")endend)task.wait(0.2)-- Let the loop run for a bitfor_,valueinpairs(getreg())doifvalue~=loop_threadthencontinueendprint(`Found loop thread: {loop_thread}`)-- Should printcoroutine.close(loop_thread)-- Should close the threadbreakend