I do agree that this behavior seems unintended, but a simple patch is to make the new frame a descendant of PlayerGui before parenting the old frame to it. Simply switch the last two lines of your function.
It may solve the repofile, but it does not work when applied to my real Gui.
Even if this was the work-around itās still a major glitch that needs to be fixed.
Surely there is some way this can be applied to your real gui. Just make sure that you arenāt parenting existing guis to descendants of nil. I agree that this is a major glitch and needs immediate attention, but Iād hate to see it break a game of yours when a patch is available.
function ModuleAPI:SetFullscreen(frame)
local part = Instance.new("Part",workspace)
part.Anchored = true
part.Transparency = 1
local surface = Instance.new("SurfaceGui")
surface.Face = "Back"
surface.Parent = part
local content = Instance.new("Frame")
content.BackgroundTransparency = 1
content.Size = UDim2.new(1,0,1,-36)
content.Position = UDim2.new(0,0,0,36)
content.Parent = surface
local obj3d = Object3D.create(part,CFrame.new(0,0,0))
obj3d.Background = true
table.insert(objects,obj3d)
part.Anchored = true
part.Parent = cam
print("BEFORE")
local c = frame.StoreFrame:GetChildren()
for i,v in pairs(c) do
print(v)
end
frame.Parent = content
print(frame.Parent)
print("AFTER")
local c = frame.StoreFrame:GetChildren()
for i,v in pairs(c) do
print(v)
end
Since youāre using a SurfaceGui, try parenting the SurfaceGui object to PlayerGui and setting surface.Adornee = part. Iāll test it myself as soon as I can.
EDIT:
I slightly modified the code from your original repro file to use a SurfaceGui, and I could not reproduce the problem of children being removed. Is there any other code that modifies the children of the gui?
This is the modified code:
local frame = script.Parent:WaitForChild("Frame")
function func(m)
local part = Instance.new("Part", game.Workspace)
local surface = Instance.new("SurfaceGui", part)
local content = Instance.new("Frame")
content.BackgroundTransparency = 1
content.Size = UDim2.new(1,0,1,-36)
content.Position = UDim2.new(0,0,0,36)
content.Parent = surface
m.Parent =content
end
print("BEFORE")
for i,v in pairs(frame:GetChildren()) do
print(v)
end
func(frame)
print("AFTER")
for i,v in pairs(frame:GetChildren()) do
print(v)
end
I even tried placing the frame in playergui to see if it gets removed then, it doesnt.
So I had it in playergui, when I dragged it from playergui and place it in the frame inside surfacegui then everything inside it got deleted.
I just started interning there again today. I will ask someone about getting the tag :P. Donāt worry too much about a repro that works with FE, I think I know what causes this issue and have a fix for it. I will test this fix more tomorrow and hopefully get it submitted.