Setting SurfaceGui Adornee to a part that is not descendant of game causes UI to not render

When I reparent my SurfaceGui (may be worth noting that this SurfaceGui is being cloned from ReplicatedStorage) to PlayerGui and set it to a part with SurfaceGui.Adornee, it will not render even after setting SurfaceGui.Enabled (unless done so in the properties tab).

Edit: seems to happen even when changing the adornee of any SurfaceGui.
Edit 2: This issue persists when setting adornee to a part that isn’t a descendant of game. Once the part is a descendant of game the UI won’t render and requires Enabled to be set in the explorer to resolve the issue.

Video of the problem:

Expected behavior

I expect for the SurfaceGui to render correctly on the part.



Just for fun I tried to reproduce the issue, but reparenting and adornees worked exactly as expected, both using a local and a server script.

I kindly suggest sending some sort of a repo file for easier debugging.

1 Like

Can’t provide a file at the moment, but here is a detailed run-down of exactly what I am doing.

  • Model exists in ReplicatedStorage with the SurfaceGui parented to it, Adornee unset.
  • The SurfaceGui contains a viewport frame, so it has to be parented to PlayerGui for the Viewport to render its contents.
  • My code creates a copy of this model using :Clone and then sets the cloned SurfaceGui’s Adornee to the desired part of the model (the adornee is a normal BasePart with material being Glass).
  • Cloned SurfaceGui is then reparented to PlayerGui and the newly cloned Model is parented to the workspace.

Other solutions I have tried include:

  • Setting adornee after reparenting.
  • Creating a new SurfaceGui using and setting it’s adornee and parent to the desired part and PlayerGui respectively. Then reparenting the contents of the cloned SurfaceGui into the new SurfaceGui.
  • Having the SurfaceGui be in StarterGui with no Adornee and then setting Adornee when the model is created and parented to workspace.

Reliable repo method: setting SurfaceGui.Adornee when the adornee part is not a descendant of game causes this issue to happen. This behaviour isn’t documented under SurfaceGuiBase.

1 Like

Are you using server scripts to do this or a local script?

1 Like

This was done using a local script.

1 Like

It’s intended behavior for a SurfaceGui to not render unless its Adornee part is parented to the datamodel. The exact location isn’t important, the part can be somewhere that it won’t render, such as ReplicatedStorage.

There was a bug related to this that I fixed back in August. Previously, the SurfaceGui would only decide to render or not at the time that its Adornee is set. This meant that when the Part was then reparented, the SurfaceGui didn’t update whether it should render. The fix made it listen to changes in the ancestry of the part.

Based on your description, I suggest parenting the entire model into the PlayerGui, or only cloning the SurfaceGui instead of the entire model.

1 Like