ObjectValues In StarterGui Incorrectly Moving To PlayerGui

If you have an ObjectValue inside of StarterGui pointing to an object also in StarterGui, the Value is not moved over to the PlayerGui copy at run time.

For example:

StarterGui.ScreenGui.Value.Value is StarterGui.ScreenGui2

Press Play

PlayerGui.ScreenGui1.Value.Value is still equal to StarterGui.ScreenGui2, not PlayerGui.ScreenGui2 as expected.

I have used this method in the past without issues - maybe the relatively recent UI backend changes are the cause of this?

Here is a repro if needed:
StarterGui ObjectValue Bug.rbxl (13.4 KB)


This is expected behavior. When you copy an Instance which contains ObjectValue descendants the reference will be updated to the copied version if the reference is also a descendant of the copied Instance. In this case the reference is to another ScreenGui which is not copied in the same call as the ObjectValue.

You were probably using ObjectValues which were referencing descendants of the same ScreenGui in the past.


Oh, interesting!

I believe you are correct :slight_smile:

I did slightly mis-explain this. It’s not actually about being a descendant of the same Instance, it’s just the same Clone call. For example if you copied both the Instances in Studio at the same time then this would work.

So we could technically make this work by batching cloning all the GUIs in the same call, not sure if it’s something that’s a big issue though.

1 Like

That is how I understood it when you explained it as “When you copy an Instance which contains ObjectValue descendants” - extrapolating that StarterGui loops through each direct child and clones them individually rather than all at once, which causes this behaviour.

Would be nice to see this changed as it did cause some initial confusion on my part, and may for new developers who rely on ObjectValues to assist with scripting, and such.

1 Like

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