Scrolling frame problem

Hi, I’m trying to make a scrolling frame canvas size big to how many frames in it and it works but when it get added the frame get really glitchy and huge.

Heres the vid
robloxapp-20200927-1632419.wmv (403.8 KB)

Code to make the scrolling frame canvas bigger

script.Parent.ScrollingFrame.CanvasSize = UDim2.new(0,script.Parent.ScrollingFrame.UIGridLayout.AbsoluteContentSize.X, 0, script.Parent.ScrollingFrame.UIGridLayout.AbsoluteContentSize.Y)		
end)```

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

Nothing here mentions about how many contents are inside the scrolling frame, only the size of each frame based on the UIGridLayout is mentioned.

doesn’t the UiGridLayout.AbsoluteContentSize mention the total content size.

You would need to only change it when the AbsoluteContentSize property changes,
so something like this would do, if you parent it to the Scrolling frame (Because the references in the script below are like that.)

script.Parent.UIGridLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
	script.Parent.CanvasSize = UDim2.new(0, 0, 0, script.Parent.UIGridLayout.AbsoluteContentSize.Y)
end)

oh I just notice that the code I posted didn’t include the property changed function at the top but there is actually that function there btw.

Also, I believe its a vertical scrolling frame? So you don’t need really need to edit the X scale of the Canvas Size in your code.

Just let it be like it is originally.

k let me try and see if it works

is the x meant to be zero if so then is still doing that insane glitch

I don’t really think the glitch is related to the code now actually, could you check if your UIGridLayout’s Cell size is not Scale, because otherwise it will try to take up that space probably

thank you is working perfectly now :grinning:

1 Like