If you’re using a UIListLayout, automatic canvas size should work here (if it’s set to XY or just Y), otherwise, I would add up all the frame’s Y scale/offset (depending on which one you’re using) and add the spacing (Padding). Not sure if this is what you’re looking for, but hopefully it will help with your issue
I’d like to bump this with some more information, since I’m still encountering issues.
The equation shown in the above post doesnt work, it, for whatever reason, gets offset over time, & makes the canvas way larger than it should be. AutomaticCanvasSize should be doing this for me but for whatever reason its not automatically expanding when I add new items to it.
These are all of the properties relating to the issue:
Every gui in this game are sized using scale, the items are added after the game launches using the following code:
local Player = game.Players.LocalPlayer
local AttributionsModule = require(game.ReplicatedStorage:WaitForChild("Resources"):WaitForChild("Data"):WaitForChild("Attributions"))
local AttributionsTemplate = Player:WaitForChild("PlayerGui"):WaitForChild("MainHud"):WaitForChild("AttributionsFrame"):WaitForChild("AttributionsFrame")
local OriginalTemplate = AttributionsTemplate:WaitForChild("Attribution")
local AttributionSpacing = (OriginalTemplate.Size.Y.Scale + OriginalTemplate.Position.Y.Scale)
local Iteration = 0
for Index,Data in pairs(AttributionsModule.Items) do
local AttributionClone = OriginalTemplate:Clone()
AttributionClone.Parent = AttributionsTemplate
AttributionClone.Position = UDim2.new(.02,0,(AttributionSpacing * Iteration),0)
AttributionClone.Creator_Name_Label.Text = Data.Creator_Name
AttributionClone.Platform_Name_Label.Text = ("of "..Data.Creator_Platform)
AttributionClone.Attribution_Description.Text = Data.Contribution_Description
AttributionClone.Link_Text.Text = Data.Link
Iteration += 1
AttributionsTemplate.CanvasSize = UDim2.new(0,0,(AttributionSpacing * (Iteration - 1)),0) --This is the line that is messing up, the sizing isnt correct, & it makes a bunch of extra space at the bottom.
OriginalTemplate.Parent = nil
The thing that confuses me is that while the size of the canvas is way too large, all of the items inside the ScrollingFrame are using the same equation, just without Iteration - 1.