Assuming you have a Script or LocalScript that calls a function from a ModuleScript and destroys itself immediately,
local f:()->() = require(game.ReplicatedStorage.SomeModuleScript)
f()
script:Destroy()
and a ModuleScript that has a function that creates a thread that waits,
return function()
task.spawn(function()
task.wait(1)
print("Hello, World!")
end)
end
the waiting thread in the ModuleScript will not run after the delay. In addition, any function or thread created from calling a ModuleScript’s functions will not run after the calling script is destroyed.
Below is a place that replicates this issue.
script-modulescript-destruction.rbxl (55.9 KB)
Expected behavior
The expected behavior from the example is that "Hello, World!" will be printed after 1 second of delay, even after the calling Script/LocalScript is destroyed.
In general, the expected behavior is that a thread or function created from calling a function from a ModuleScript will not be destroyed/disabled after the calling Script/LocalScript is destroyed.