Hello, In short what i want to achieve is simple:
Having the padding on the top and bottom be the same.
Currently when i change the padding on the top or the bottom it increases the frame size which i do not want to happen.
I want it so like if i change the padding on the top or bottom it will like make the area for the gridlayout elements smaller and have the Padding on the top and Bottom
Issue:
I cant not change the top padding gap without it increasing the frames Size on the bottom instead of it sliding down
This is because in roblox on a gridLayout its mandatory to have VerticalAlignment Top or Bottom Active.
Things I have Tried:
I have tried using GridLayout: Vertical Alignment Center but that causes issues and doesnt scale corectly.
I have tried manually making a system like this without the use of a grid layout and padding but my whole script is made on it. so its breaks everything sadly
Here is my code if anybody can help me 
function InventoryInfo:UpdateCanvasSize()
task.wait(0.1)
local scrollingFrame = InventoryInfo.Holder.InventoryFrame.Parent
local inventoryFrame = InventoryInfo.Holder.InventoryFrame
local gridLayout = inventoryFrame and inventoryFrame:FindFirstChild("UIGridLayout")
local uiPadding = inventoryFrame and inventoryFrame:FindFirstChild("UIPadding")
local contentHeight = gridLayout.AbsoluteContentSize.Y
local topPadding = (uiPadding.PaddingTop.Scale) * scrollingFrame.AbsoluteSize.Y
inventoryFrame.Position = UDim2.new(inventoryFrame.Position.X.Scale, 0, 0, topPadding)
local frameHeight = scrollingFrame.AbsoluteSize.Y
local desiredHeight = math.max(contentHeight, frameHeight)
scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, desiredHeight)
end
local scrollingFrame = InventoryInfo.Holder.InventoryFrame.Parent
is same as
local scrollingFrame = InventoryInfo.Holder
is that really what you want?
Have you tried ScrollingFrame.AutomaticCanvasSize = Y?
I have it enabled so thats not the problem
and yes everything i have written is correct…
Its just im trying to figure out how to like increase the padding on the top without it increasing the canvas size on the bottom, or have it increase the canvas size but also like move the items down in that case
If AutomaticCanvasSize is enabled then you shouldn’t try set the canvas size.
Also, clear up your code and it might become easier to solve:
local scrollingFrame = InventoryInfo.Holder
local inventoryFrame = scrollingFrame.InventoryFrame
local gridLayout = inventoryFrame.UIGridLayout
local uiPadding = inventoryFrame.UIPadding
You dont need to ask inventoryFrame and inventoryFrame:FindFirstChild(“UIGridLayout”)
because you already assume both inventoryFrame and UIGridLayout exist in the lines further down when you do
gridLayout.AbsoluteContentSize.Y
Okay wait a little i will clean up the code.
function InventoryInfo:UpdateCanvasSize()
task.wait(0.1)
local scrollingFrame = InventoryInfo.Holder.InventoryFrame.Parent
local inventoryFrame = InventoryInfo.Holder.InventoryFrame
local gridLayout =inventoryFrame.UIGridLayout
local uiPadding = inventoryFrame.UIPadding
local contentHeight = gridLayout.AbsoluteContentSize.Y
local topPadding = (uiPadding.PaddingTop.Scale) * scrollingFrame.AbsoluteSize.Y
inventoryFrame.Position = UDim2.new(inventoryFrame.Position.X.Scale, 0, 0, topPadding)
local frameHeight = scrollingFrame.AbsoluteSize.Y
local desiredHeight = math.max(contentHeight, frameHeight)
scrollingFrame.CanvasSize = UDim2.new(0, 0, 0, desiredHeight)
end
You think you could send the file to investigate? just that ui part?
U want the whole inventory UI script and the player gui?
if you feel comfortable to share, you could send it in a message too if you dont want to share with everyone.
InventorySys_Copy.rbxl (811.0 KB)
The local inventory is in:
StarterCharacterScripts → Initilise → UI → Inventory
i sent u the whole place if that helps ;-; haha
just uhm change the function back since i forgot to edit it back sorry 
I see the problem, the UIPadding mess up the distance between items because the vertical spacing between objects is depending on the size of the frame.
How about ignore that inventory.frame and add the items directly into the scrollingframe?
I made a version here:
InventorySys_Fix.rbxl (812.2 KB)
But it also suffers the same issue, the vertical gap depends on the vertical canvassize. The solution is to set the UIGridLayout.Size = UDim2.new(0.01, 0, 0, 0.01 * UIGridLayout.Parent.Absolute.Size.X)
everytime you update it.
Would that work?
Maybe it would work. is that included in the place u sent?
I did not change any code. Just the scrollingframe contents.
Howd u do this? also theres 40 slots is that bug or?
Maybe i should just give up this seems like some obscure roblox bug that can only be fixed if i manually create some super advanced sorting mechanism.
Thank you for your help but i guess this is just an issue with roblox haha
I added multiple slots for testing, you just need to delete them and make the two templates invisible.
did that, spawned only 40 slots and for some reason all the way up there idk why