Ep 10. Canvas Groups Disappear

UPDATE 9/7/2024: Roblox has resolved this issue in release 637.

We use Canvas Group instances to create progress bars components in a few of our Guis. These instances make our job easier due to how they work, but unfortunately they come with a pretty drastic issue as well. This issue will cause all of the instances stored inside of the Canvas Group to no longer be displayed. This issue has been reported on the developer forum since late 2022.

This issue can randomly occur whenever either axis of the size of a Canvas Group is adjusted down to 0.

Solution

Luckily for our setup, the only code which causes the Canvas Groups to have this issue is written inside of the Gui Controller module and specifically the Animate Frame function. We can solve this by updating what we do when the tween is completed with the following code:

StarterPlayer/StarterPlayerScripts/Controllers/GuiController.lua
function Local.AnimateFrame(frame: Frame, isOpening: boolean)
	...
	
	tween.Completed:Connect(function()
		uiScale:Destroy()
		if not isOpening then
			local gui = frame:FindFirstAncestorOfClass("ScreenGui")
			if gui then
				gui.Enabled = false
			end
		end
		
		local canvasGroup = frame:FindFirstChildWhichIsA("CanvasGroup", true)
		if canvasGroup then
			local parent = canvasGroup.Parent
			canvasGroup.Parent = PlayerGui
			task.delay(0, function()
				canvasGroup.Parent = parent
			end)
		end
	end)
end
Contents