If a script is deleted, will the events that the script assigned be disconnected?

Title?

Let’s say I create a script and in that script i assign an event.

workspace.ChildAdded:Connect(function(ch)
    print(ch.Name, "was added")
end)

and after a few seconds i delete that script. Will it still print whenever a child is added into workspace, even if the script has been deleted? Help is nice!

I don’t really know what to search to find posts similar to this…

3 Likes

I don’t think it will but if you want to know it for sure I should try it out(by adding a child to workspace when the game is running and you deleted the script)

Yes, I’m pretty sure all connections will disconnect when a script is destroyed. However, if you set its parent to nil, it will continue to run I believe.

9 Likes

Just did some tests. Connections disconnect when the script is destroyed and when the script is parented to nil! Thank you.

5 Likes