spawn is just like running another script in one script, so if you have a infinite while loop in that function, everything below will still run because it is seperated
spawn is basically a way to create a new script whilst keeping it in all 1 script
Say I have this:
while true do
wait(1)
print("1")
end
while true do
wait(1)
print("2")
end
Now here’s the thing: Only the first loop will start but the second one won’t Why is that? Well, since both are while true do loops the script will keep running that first loop infinitely & won’t continue the second
Now here’s the cool part, we can use spawn to basically create a new entire like-script (Or thread) inside that same script while keeping our first loop running
local function Loop1()
while true do
wait(1)
print("1")
end
end
spawn(Loop1) --We want to call this function here
while true do
wait(1)
print("2")
end