Hey, I wanted to do a serverside GUI creator, but when creating a scrolling frame that automatically adjusts its size based on the absolute content size, I got stuck. I just didn’t know what to do to get that working. Any help? The following is the code I have so far: (problem is on the last line)
local Commands = Instance.new("ScreenGui")
local main = Instance.new("Frame")
local close = Instance.new("TextButton")
local minimise = Instance.new("TextButton")
local Title = Instance.new("TextLabel")
local Frame = Instance.new("Frame")
local ScrollingFrame = Instance.new("ScrollingFrame")
local UIListLayout = Instance.new("UIListLayout")
Commands.Name = "Commands"
Commands.Parent = playerUI
Commands.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
Commands.ResetOnSpawn = false
main.Name = "main"
main.Parent = Commands
main.BackgroundColor3 = Color3.fromRGB(136, 133, 123)
main.BorderSizePixel = 0
main.Position = UDim2.new(0.17509158, 0, 0.229166672, 0)
main.Size = UDim2.new(0.245421246, 0, 0.029947916, 0)
main.Active=true
main.Selectable = true
close.Name = "close"
close.Parent = main
close.BackgroundColor3 = Color3.fromRGB(186, 122, 122)
close.BorderSizePixel = 0
close.Position = UDim2.new(0.939750433, 0, 0, 0)
close.Size = UDim2.new(0.0597014911, 0, 1, 0)
close.Font = Enum.Font.SourceSans
close.Text = ""
close.TextColor3 = Color3.fromRGB(0, 0, 0)
close.TextSize = 14.000
minimise.Name = "minimise"
minimise.Parent = main
minimise.BackgroundColor3 = Color3.fromRGB(186, 171, 127)
minimise.BorderSizePixel = 0
minimise.Position = UDim2.new(0.879500985, 0, 0, 0)
minimise.Size = UDim2.new(0.0597014911, 0, 1, 0)
minimise.Font = Enum.Font.SourceSans
minimise.Text = ""
minimise.TextColor3 = Color3.fromRGB(0, 0, 0)
minimise.TextSize = 14.000
Title.Name = "Title"
Title.Parent = main
Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Title.BackgroundTransparency = 1.000
Title.BorderSizePixel = 0
Title.Position = UDim2.new(0, 0, 0.0869565234, 0)
Title.Size = UDim2.new(0.877611935, 0, 0.826086938, 0)
Title.Font = Enum.Font.SourceSansBold
Title.Text = "Commands"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.TextScaled = true
Title.TextSize = 14.000
Title.TextWrapped = true
Frame.Parent = main
Frame.BackgroundColor3 = Color3.fromRGB(126, 123, 114)
Frame.BorderSizePixel = 0
Frame.Position = UDim2.new(0, 0, 1, 0)
Frame.Size = UDim2.new(1, 0, 0.615554094, 0)
Frame.SizeConstraint = Enum.SizeConstraint.RelativeXX
ScrollingFrame.Parent = Frame
ScrollingFrame.Active = true
ScrollingFrame.BackgroundColor3 = Color3.fromRGB(116, 113, 105)
ScrollingFrame.BorderSizePixel = 0
ScrollingFrame.Position = UDim2.new(0.017910447, 0, 0.040229775, 0)
ScrollingFrame.Size = UDim2.new(0.961194038, 0, 0.916556656, 0)
ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
UIListLayout.Parent = ScrollingFrame
UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Right
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
for i,o in pairs(list) do
local TextLabel = Instance.new("TextLabel")
TextLabel.Parent = ScrollingFrame
TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextLabel.BackgroundTransparency = 0.990
TextLabel.Position = UDim2.new(0.0372670814, 0, -8.07327467e-08, 0)
TextLabel.Size = UDim2.new(0.962732911, 0, 0.0561531745, 0)
TextLabel.SizeConstraint = Enum.SizeConstraint.RelativeXX
TextLabel.Font = Enum.Font.SourceSansItalic
TextLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
TextLabel.TextScaled = true
TextLabel.TextSize = 14.000
TextLabel.TextWrapped = true
TextLabel.TextXAlignment = Enum.TextXAlignment.Left
TextLabel.Text=o
end
main.Draggable=true
ScrollingFrame.CanvasSize=UDim2.new(0,0,0,???) -- SET THE CANVAS SIZE BASED ON CONTENT INSIDE