I’ve been trying to separate textlabels into individual textlabels of one character (in order to create a gradient effect). However, a major issue arises when I start to place them - is there any automatic way to get the kerning right? For the time, I’ve been giving every single individual textlabel an equal length (the length of the original label divided by the amount of characters it holds), but this has caused some problems:
![]()
Clearly, the kerning is off, since all letters are not the same size. Is there a way to automatically access information about what size I should make the characters?
This is the code I’m using, if anyone is interested:
while wait() do
local chat = game.Players.BitLang.PlayerGui.Chat.Frame.ChatChannelParentFrame.Frame_MessageLogDisplay.Scroller;
for i,v in pairs(chat:GetChildren()) do
if v.Name == "Frame" then
if v.TextLabel:FindFirstChild("TextButton") then
size = v.TextLabel.TextButton.Size;
v.TextLabel.TextButton:Destroy();
local folder = Instance.new("Folder");
listLayout = Instance.new("UIListLayout");
listLayout.Parent = folder;
listLayout.FillDirection = Enum.FillDirection.Horizontal;
folder.Parent = v.TextLabel;
openBracket = Instance.new("TextLabel");
openBracket.Name = "1";
openBracket.Text = "[";
openBracket.Parent = folder;
openBracket.Size = UDim2.new(0, size.X.Offset/(string.len("BitLang")+3), 1, 0)
openBracket.BorderSizePixel = 0;
openBracket.BackgroundTransparency = 1;
openBracket.Font = Enum.Font.SourceSansBold;
openBracket.TextSize = 16;
for i,v in pairs(string.split("BitLang", "")) do
local textLabel = Instance.new("TextLabel");
textLabel.Text = v;
textLabel.Name = tostring(i+1);
textLabel.Parent = folder;
textLabel.Size = UDim2.new(0, size.X.Offset/(string.len("BitLang")+3), 1, 0)
textLabel.BorderSizePixel = 0;
textLabel.BackgroundTransparency = 1;
textLabel.Font = Enum.Font.SourceSansBold;
textLabel.TextSize = 16;
end
closeBracket = Instance.new("TextLabel");
closeBracket.Name = "="..tostring(2+string.len("BitLang"));
closeBracket.Text = "]";
closeBracket.Parent = folder;
closeBracket.Size = UDim2.new(0, size.X.Offset/(string.len("BitLang")+3), 1, 0)
closeBracket.BorderSizePixel = 0;
closeBracket.BackgroundTransparency = 1;
closeBracket.Font = Enum.Font.SourceSansBold;
closeBracket.TextSize = 16;
colon = Instance.new("TextLabel");
colon.Name = "_"..tostring(3+string.len("BitLang"));
colon.Text = ":";
colon.Parent = folder;
colon.Size = UDim2.new(0, size.X.Offset/(string.len("BitLang")+3), 1, 0)
colon.BorderSizePixel = 0;
colon.BackgroundTransparency = 1;
colon.Font = Enum.Font.SourceSansBold;
colon.TextSize = 16;
end
end
end
end


