Roblox shows that you can use the following code to ensure the hit connection is disconnected. I was curious if you could do the same for connections in scripts? Or should you just stick to keeping track of all connections and disconnecting them when they are no longer needed? Furthermore I’m curious to know if this method could also get rid of tweens??
From my understanding the connections will be disconnected however sometimes they may not be leading to a memory leak so its better to keep track of all connections and disconnect them yourself??
-- To ensure our .Hit connectdion gets isconnected, destroy the explosion once it's removed.
explosion.AncestryChanged:Connect(function()
if not explosion.Parent then
explosion:Destroy()
end
end)