Value property of ObjectValue not preserved when copying and pasting

Repro place: objectvalue_bug.rbxl (12.4 KB)

  1. Select the Value object. Its value is set to the Part in the workspace.
  2. Copy with Ctrl+C
  3. Paste with Ctrl+V
  4. The new object’s value is nil, rather than being set to Part like the original object.

This also happens when copying and pasting a model which contains an ObjectValue.

In some cases (such as if the value is set to a descendant of that Value object) the value property is preserved, but in most all other cases, it is lost.

Also, if you duplicate the Value object with Ctrl+D, it actually does retain the original value. It just doesn’t work with traditional copy-and-paste.

2 Likes

This happens because of how copied objects are serialized. The Value property becomes nil whenever the referred object is not included in the copied data.

To make this work as expected would require the serialized data to store some kind of external marker that refers to an object that isn’t serialized, but exists somewhere. When the data is pasted, studio would attempt to look for an object associated with the marker, and set the property to the object if it exists.

The XML format has an <External> tag which might have been used for this purpose at some point. Unfortunately, the binary format (which is used for the clipboard) has no hints of support for this.

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.