Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How come disabled scripts still run? like thats some next level

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???

1 comment

0

roblox too much weed smoke

1 answer

✓ Accepted answer

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.

1 comment

0

see this is exactly how u answer a question bro. gonna check some other things for now here r some reps

This discussion is preserved as it was. New answers, comments, and votes are closed.