I am trying to create a script that will detect the size of the parent frame, and perfectly scale a set number of images in the frame. Somehow still i can’t get it so that the right edge is the same as the left. (picturesframe is the frame, the frame also has a UIPadding and UIGridLayout in it)
local imageNumber = 8
local framescale = picturesframe.AbsoluteSize.X
local cellPadding = (framescale * .05) / 10
local leftoverscale = framescale - (cellPadding * (imageNumber + 2))
local cellSizeX = leftoverscale / imageNumber
picturesframe.UIGridLayout.CellPadding = UDim2.new(0, cellPadding, 0, cellPadding)
picturesframe.UIGridLayout.CellSize = UDim2.new(0, cellSizeX, 0, cellSizeX)
picturesframe.UIPadding.PaddingLeft = UDim.new(0,cellPadding)
picturesframe.UIPadding.PaddingRight = UDim.new(0,cellPadding)
picturesframe.UIPadding.PaddingTop = UDim.new(0,cellPadding)
picturesframe.UIPadding.PaddingBottom = UDim.new(0,cellPadding)