Create different threads for each loop, this can be achieved using coroutines:
coroutine.wrap(function()
while task.wait(1) do
print("loop 1")
end
end)()
coroutine.wrap(function()
while task.wait(1) do
print("loop 2")
end
end)()
or with the new task library:
task.spawn(function()
while task.wait(1) do
print("loop 1")
end
end)
task.spawn(function()
while task.wait(1) do
print("loop 2")
end
end)
PS: when the script gets destroyed/disabled, the loops will still run.