For the opening screen of my game I’d like to have the title’s text extend to the edges of its frame. I’d like to accomplish this through adjusting the tracking of the text (the width of the space between each letter). How would I go about doing this? Is it even possible?
You won’t be able to achieve this look with just a single TextLabel would you need 1 TextLabel per character. What you can do is have them all in a single frame with a UIListLayout and set the HorizontalFlex to “SpaceBetween” and you should get the result your looking for.
function StringToSingleCharacters(AttachTo: Instance, String: string, TextLabel: TextLabel?): {string}
assert(AttachTo:IsA("GuiObject"), `Arg[1] is not of classtype "GuiObject"`)
assert(typeof(String) == "string", `Arg[2] is not type expected type "string"`)
local StringToTable = string.split(String, "") -- Split the string into a table so we can loop through it
for Index: number, Character: string in StringToTable do
local CloneTextLabel = if TextLabel then TextLabel:Clone() else Instance.new("TextLabel") -- If you do pass through a TextLabel it will clone it else it'll just make a new one
local IsCloned = TextLabel ~= nil or false
CloneTextLabel.Name = `{Index}_{Character}`
CloneTextLabel.LayoutOrder = Index
CloneTextLabel.Text = Character
if not IsCloned then
CloneTextLabel.BackgroundTransparency = 1
CloneTextLabel.Size = UDim2.fromOffset(30, 30)
end
CloneTextLabel.Parent = AttachTo
end
return StringToTable
end
StringToSingleCharacters(game.StarterGui.Main.Frame, "The Warehouse")