Can a script connect to its own disable a terminal function?

Likewise, can it, like the PlayOnDestroy behavior of sounds, have a terminal function for being deleted? Or, does disable and destroy yield with no exception? How about the script requiring a modulescript, firing a bindableEvent or any other thing with potential for this situation?

1 Like

I tried this code:

script:GetPropertyChangedSignal("Disabled"):Connect(function()
    if script.Disabled then
    	print("Script is disabled!")
    end
end)

and when i disabled the script, nothing was printed, so i guess the answer is no for as far as i can see.

If the script would be disabled all of the code inside it will be null, or inactive. If you want to connect OnRemove or OnDisable, you can use Remote Events.