Weird error in output

I’m making a plugin that replaces a part with a meshpart, but if I undo a action after a part has been replaced this warning will always pop up and the part & meshpart will vanish.

18:13:30.456 - The Parent property of Part is locked, current parent: NULL, new parent Workspace

What does this mean and how can I fix this? I already tried ChangeHistoryService it doesn’t work.

You’re preserving a reference to an object (the part in question) that has been moved outside of the workspace service and into an elevated portion of parent-child hierarchy, presumably the DataModel where it is no longer accessible to the ChangeHistoryService.

Edit: I’m going to assume you are using :Destroy() which

Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections and calls Destroy on all children.

1 Like

Yes, is there a fix to that? Or is there another way to replace a part with a meshpart?

Use :Remove() and I believe it should resolve your problems. The destroy function should be reserved for instances where the object will never be used again and is typically used to free up server resources. I normally refrain from using destroy within my plugins unless it is in reference to an object outside of the DataModel. There are simply too many changes happening within the games DataModel to not preserve waypoint data.

If you were worried about memory usage with your plugin you could always Destroy the parts after a certain number of Waypoints

1 Like