Okay, so im curently making a game in roblox and i found this problem.
I though that it was weird that my scripts would keep on going even though i had made them disable themself, so i tried to test it with this little code
while true do
if script.Disabled == true then
print ("Im Dead")
else
print ("Im Alive")
end
wait(0.2)
if script.Disabled == false then
script.Disabled = true
print ("Disabled")
end
if script.Disabled == true then
print ("Im Dead")
else
print ("Im Alive")
end
end
It could probably have been made easier, but i though this was fine. What i wanted to see with this code was if the script would disable itself, and then stop afterwards, but when i looked at the output i was amazed. It looked like this:
Im Alive
Disabled
Im Dead
Im Dead
Im Dead
Im Dead
and it just kept going on saying "Im Dead". I just found this a bit weird. I didn't understand why the script kept going on even though it said it was disabled. I tried putting the killswitch on another part with this script.
function onTouched()
workspace.Script.Disabled = true
end
script.Parent.Touched:connect (onTouched)
But the output was still the same. Even though i touched the killswitch. After i tried to remove the
if script.Disabled == false then
script.Disabled = true
print ("Disabled")
end
part in the (while true do) script. And when i tested it, i was amazed. The output now looked like
Im Alive
Im Alive
Im Alive
Im Alive
Im Alive
ect. ect. And when i hit the killswitch the output just stoped, immediately, like it should if the while true script disabled itself
I don't know why this happens. Some of you must have run into this problem before. Can you help me? I have ideas to fix this problem, but they are not optimal at all, so i hoped you could help me.

2 comments
In the past I was told that Roblox has an issue with ending scripts by disable and an issue with cutting off threads. Also, in filteringenabled you'll notice issues of objects being removed, such as scripts, but never actually leaving from the server requiring extra checks.
Dont use while true do, use script.Parent.Changed:Connect(), having a lot of these scripts with whilet rue do can cause lag.