Do you have to disconnect Explosion.Hit connections?

Basically the title, after an explosion is done emitting its particles, it gets either destroyed or parented to nil. Because of this, does it automatically disconnect the Explosion.Hit connection or do I have to handle that myself?

I would think it’d automatically disconnect, as when ever an instance gets destroyed, associated connection objects with it will get cleaned up.

(as documented on the Explosion class page, Explosions will remove shortly.)

1 Like

Ah okay, wasn’t sure if the explosions were actually destroyed or just parented to nil.

1 Like

They’re not actually destroyed, they’re simply parented to nil, you can test by running the following code.

local explosion = Instance.new("Explosion")
task.wait(3)
explosion.Parent = workspace
print(explosion.Parent)
task.wait(5)
explosion.Parent = workspace
print(explosion.Parent)

Two explosions will occur.

1 Like

Ah okay, good to know, thanks!

local explosion = Instance.new("Explosion")
local connection
connection = explosion.Hit:Connect(function()
	print("Hello world!")
end)
explosion.Parent = workspace
task.wait(10)
print(connection.Connected) --true
1 Like