Let’s say there’s a IntValue in the workspace.
The client has done a .Changed connection.
Now, a server script deletes it.
Will it cause a memory leak to the client?
Let’s say there’s a IntValue in the workspace.
The client has done a .Changed connection.
Now, a server script deletes it.
Will it cause a memory leak to the client?
Calling :Destroy() will break all connections to that instance from all scripts.
Actually, destroying an instance on the server doesn’t cause its connections to get disconnected on the client, nor does it lock the Parent property on the client. This is a known bug and has been discussed here a few times before
Ah, alright. Didn’t know that was bugged.
Due to this bug, you could Disconnect it yourself by connecting on workspace.ChildRemoving and comparing it’s properties.
Here’s a little example
local c do
c = workspace.IntValue.Changed:Connect(function(child)
--any code
end)
end
workspace.ChildRemoving:Connect(function(child)
if child:IsA("IntValue") and c then --compare any other properties
c:Disconnect()
c = false
end
end