Hello Developers!
I’m working on a selection system for Parts in the workspace and I need to store a refence to the part with ObjectValue
. So, I detect ObjectValue.Value.Changed
and connect that to a function. Like this code here
script.ConnectedObject.Value.Changed:Connect(function(Property: string)
-- Do Stuff
end)
Now, let’s say I change ObjectValue.Value
to a different Instance in the workspace.
Do I have to Disconnect()
the ObjectValue.Value.Changed
to prevent a memory leak? I asked Roblox’s AI assistant. (And check the official documentation) Here’s what I got from it:
“According to the Roblox documentation, connecting a .Changed event to an ObjectValue.Value and then changing said ObjectValue.Value with the .Changed event still connected will not cause a memory leak.” -
I wanted to run this by developers who know more about memory leaks and all that stuff.