ViewportFrames fail to display contents after changing Parent

This problem occurs (and can be reproduced 100% of the time) in these circumstances:

  1. A ViewportFrame has children and a camera to view them.
  2. ViewportFrame.Parent is set to some visible gui object and thus shown on screen, as expected.
  3. ViewportFrame.Parent is set to nil.
  4. Immediately after, the Frame (former parent) is destroyed via Frame:Destroy(). Steps 3 and 4 must happen sequentially without yielding between.
  5. ViewportFrame.Parent is set to a new gui object.

ViewportFrame’s contents will now be invisible (the ViewportFrame itself will be visible) until one of its ancestor’s visibility is toggled.

Below I have attached a video of the problem occurring and being fixed by inverting the Visible property. I have also attached the place file used to make the video, the code of interest is located in StarterGui → ScreenGui → LocalScript.


viewportframe_glitch.rbxl (27.2 KB)

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up when we have an update for you.

1 Like