Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago
Edited 4 years ago

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

0
roblox too much weed smoke royaltoe 5144 — 4y

1 answer

Log in to vote
2
Answered by
Alphexus 498 Moderation Voter
4 years ago

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.

0
see this is exactly how u answer a question bro. gonna check some other things for now here r some reps programmerHere 371 — 4y
Ad

Answer this question