Why isn't my script getting the absolute content size of a UI constraint properly?

So I am making a debug console for moderators in my game who do not have direct access to the developer console made by Roblox. It is working for the most part except for this part here:

script.Parent.Parent.ScrollingFrame.CanvasSize = UDim2.new(0, script.Parent.Parent.ScrollingFrame.UIListLayout.AbsoluteContentSize.X, 0, script.Parent.Parent.ScrollingFrame.UIListLayout.AbsoluteContentSize.Y)

For some reason, it doesn’t fit all of the text labels in the scrolling frame, and it ends up setting the canvas size to random offset values like shown here:

image
image

Is there a solution for this?