Do scripts deactive when the parent is destroyed?

Do scripts deactive when the parent is destroyed? I use the developer console and still script activity even though the parent is destroyed does it actually become inactive or is it still running?

2 Likes

I’m pretty sure they deactivate because they no longer exist

Depends on what script it is, if it’s a function let’s say:

local function SayHi()
    wait(5)
    print("Hello!")
end

SayHi()

And on another script:

wait(1)
workspace.Part:Destroy() --Assuming the script s inside the workspace's Part

If I recall, the function will still run regardless if it’s destroyed/disabled or not to finish off it’s end statement

But if you’re using something like an Event, then they can be Deactivated fairly easy (As they won’t fire until triggered)

And I’m 75% sure that someone is gonna correct me if that’s the case

Scripts stop running when they have Destroy called on them. Any events associated with the deleted instance will also get disconnected automatically.

2 Likes