alright so a few weeks ago i found a devforum post that talked about what happens to a script when its destroyed. also disabled scripts still running were briefly mentioned but not explained entirely. once i find it ima link it, but for now this was roughly the code:
script.Disabled = true print("nop") -- doesn't print while true do print("yap") wait(0.5) end
yap
freaking printed. not even joking if u dont believe me test for urself. most ppl just jump to conclusions too quickly and tend to minimod. so actually test it thanks. does it have to do with like threads n stuff
like wth roblox u high or sum???
When you run a script, it runs that code on what you call a thread. A thread can be described as a branch of code. The code runs on that thread until it's finished running. In this case, you are running an infinite while loop
on a thread. When a script gets disabled, the while loop will still be running in the thread. If you try disabling and enabling the script, it's basically running the code all over again on a new thread. Threads can be useful for running code at the same time as something else, but too many threads can also lower performance.