So I have an inventory GUI. When items are added the canvas size of the scrolling frame increases. Unforunately, when this happens it affects the size and position of the buttons.
I just need to know how I'd calculate the size and the position of the button so it looks like the same size and is spaced out the same no matter what the size of the canvas is.
This is what I've tried. I can't get the math right.
local getInventory = player.Inventory:GetChildren() for i,Item in pairs(getInventory) do if Item.ClassName == "IntValue" then local button = Instance.new("TextButton",GUI.Inventory.InventoryList) button.Size = UDim2.new(0.925,0 (0.055/GUI.Inventory.InventoryList.CanvasSize.Y.Scale),0) button.Position = UDim2.new(0.025,0,(PositionUI + 0.015),0) PositionUI = PositionUI + 0.065/GUI.Inventory.InventoryList.CanvasSize.Y.Scale end end PositionUI = 0