Automatic Canvas Size based on Cell Size (not Offset)

Hello!
I need help to automatically change the canvas size based on the cell size

My current LocalScript only modifies the fourth parameter which is Y.Offset. I’ve tried everything but I can’t find the pattern to change the Scale.

StatsFrame.StatsBackg.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,StatsFrame.StatsBackg.ScrollingFrame.UIGridLayout.AbsoluteContentSize.Y)