I’m having some very peculiar issues when it comes to laying out text labels inside a frame. Check this out:
local function newLog(title, body, ...)
local log = Instance.new("Frame")
log.Name = title
log.AutomaticSize = Enum.AutomaticSize.Y
log.Size = UDim2.new(1, 0, 0, 0)
log.BackgroundTransparency = 1
log.BorderSizePixel = 0
local logList = Instance.new("UIListLayout")
local titleLabel = Instance.new("TextLabel")
titleLabel.Name = "Title"
titleLabel.BackgroundColor3 = Color3.fromRGB(23, 92, 255)
titleLabel.BorderSizePixel = 0
titleLabel.Size = UDim2.new(1, 0, 0, 32)
titleLabel.Font = Enum.Font.GothamMedium
titleLabel.Text = title
titleLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
titleLabel.TextSize = 14
local bodyLabel = Instance.new("TextLabel")
bodyLabel.Name = "Body"
bodyLabel.AutomaticSize = Enum.AutomaticSize.Y
bodyLabel.BackgroundTransparency = 1
bodyLabel.BorderSizePixel = 0
bodyLabel.Size = UDim2.new(1, 0, 0, 0)
bodyLabel.Font = Enum.Font.Gotham
bodyLabel.Text = string.format(body, ...)
bodyLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
bodyLabel.TextSize = 10
bodyLabel.TextWrapped = true
bodyLabel.TextXAlignment = Enum.TextXAlignment.Left
bodyLabel.TextYAlignment = Enum.TextYAlignment.Top
local bodyPadding = Instance.new("UIPadding")
bodyPadding.PaddingBottom = UDim.new(0, 8)
bodyPadding.PaddingLeft = UDim.new(0, 8)
bodyPadding.PaddingRight = UDim.new(0, 8)
bodyPadding.PaddingTop = UDim.new(0, 8)
log.Parent = List
logList.Parent = log
titleLabel.Parent = log
bodyLabel.Parent = log
bodyPadding.Parent = bodyLabel
end
This is the code required to generate a new log in my changelog tab for my game Desk Job. Something about this process is screwing up, because once adding a new log, like this:
local updates = {
-- Logs currently placeholders
newLog(
"Let There Be Title Screen",
[[Look, mom! A new update! In today's update to Desk Job, we have a few new things:
> A new title screen (so shiny)
> A background for our title screen (so shiny)
> Messy code (not so shiny)
That's all for today. See you tomorrow!]]
),
newLog(
"The Summer Update",
[[Purely hypothetical, but what if we updated the game for summer? Well, we did just that. Introducing...
> 14 new cubicle skins
> 27 new paper options
> VIP gamepass
That's all for today. See you in the future!]]
)
}
They layout in a very confusing way, where the title is underneath the body, instead of above it.
I can’t seem to figure out why this is formatting like this, or how to fix it. This is the log hierarchy:
^ This is nested inside a ScrollingFrame with a UIListLayout that acts as the main “content” panel.
I’ve tried messing with LayoutOrder, DisplayOrder, and ZIndex, with absolutely no luck.