Please understand that the sentences may be a little strange because we used a translator. sorry.
I usually use the “AutoScale” plugin to make the gui shrink or grow according to the size of the window.
But, Instance.new to create GUI, the “AutoScale” plugin could not be used for them.
I’m curious how I can make the GUI created through Instance.new transform to fit the size of the window.
local function createImageLabel(parent, assetId)
local columnIndex = (#parent:GetChildren() - 1) % 7
local rowIndex = math.floor((#parent:GetChildren() - 1) / 7)
local imageLabel = Instance.new("ImageLabel")
imageLabel.Size = UDim2.new(0, 100, 0, 100)
imageLabel.Position = UDim2.new(0, columnIndex * 105, 0, rowIndex * 105)
local thumbnailUrl = "https://www.roblox.com/asset-thumbnail/image?assetId="..assetId.."&width=420&height=420&format=png"
imageLabel.Image = thumbnailUrl
imageLabel.Parent = parent
local aspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
aspectRatioConstraint.AspectRatio = 1
aspectRatioConstraint.Parent = imageLabel
return imageLabel
end
This is the script that generates the gui. I tried scaling it using “UIAspectRatioConstraint” as seen in the “AutoScale” plugin, but it didn’t work at all. Please help me…