UI elements getting deleted in game?

Not sure if this is the right category for this but it may be related to scripting since it only happens because when this is in my GuiManger

In my game I have a GuiManager that manages all the UI and for some reason there’s 2 children in the the Hair Frame which get deleted in game?

I’ll show you what happens. This is what it looks like in studio (before running the game)
image

Now in game this is how it looks: (in-game studio)
image

As you can see in game the children of Hair aren’t there.

What I have tried so far?
I tried to leave it in ScreenGui and it works but my system won’t work since it’s not in the GuiManager

I tried to print all descendants of the ColorUI and everything prints correctly but for some reason, it isn’t there. I have no :Destroy() functions in the script so that can’t be the issue.

The script has other functions but I tried to just clone it and parent it to playerGui and still doesn’t show the frames.

I tried using ChildRemoved and it prints twice which means the frames are doing something but I’m not sure what?

That’s really all I’ve tried

Additional Info:
My GuiManager is located in ReplicatedStorage

I can’t really show you the whole code since it’s a lot of code. I’ll show you how all my Gui are made

-- Constructor
function Gui.new(guiManger, playerGui)
   local self  = setmetatable({}, Gui)

   local Gui = AssetLibrary.GetAsset("Gui.ColorUI"):Clone()
   Gui.Parent = playerGui

   self.Frame = Gui:WaitForChild("Holder")
   -- etc

   return self
end

This is the basic script which I don’t see any issues since all my other Gui uses this and the Asset Library looks like this:

function AssetLibrary.GetAsset(path : string)
	local args = string.split(path, ".")
	
	local lastPath = nil
	
	for _, p in pairs(args) do
		if not lastPath then
			lastPath = script:WaitForChild(p)
		else
			lastPath = lastPath:WaitForChild(p)
		end
	end
	
	return lastPath
end

Hope this is helpful but I’m not sure why they get removed. Could this be a studio bug?

2 Likes

Okay, this was my bad :sweat_smile: I just found a function that was destroying it I didn’t see it until now since it’s only 4 lines I must have skipped past it!