Ive been trying to seperate letters in order to make Specific Text Effects which arent possible normally
I was able to make this code to do so
local function cText(textLabel)
local text = textLabel.Text
local font = textLabel.Font
local textSize = textLabel.TextSize
local totalTextWidth = 0
local maxHeight = 0
local Letters = {}
local TextSizeInfo = {}
local startX = (textLabel.AbsoluteSize.X - totalTextWidth) / 2
local startY = (textLabel.AbsoluteSize.Y - maxHeight) / 2
local totalWidth = startX
for i = 1, #text do
local letter = text:sub(i, i)
local textSizeInfo = textService:GetTextSize(letter, textSize, font,Vector2.one*1000)
local letterLabel = Instance.new("TextLabel")
letterLabel.Text = letter
letterLabel.Size = UDim2.new(0, textSizeInfo.X, 0, textSizeInfo.Y)
letterLabel.Position = UDim2.new(0, totalWidth + 0, 0, startY + (maxHeight - textSizeInfo.Y) / 2)
letterLabel.BackgroundTransparency = 1
letterLabel.TextSize = textSize
letterLabel.Font = font
letterLabel.TextColor3 = textLabel.TextColor3
letterLabel.TextStrokeTransparency = textLabel.TextStrokeTransparency
letterLabel.TextStrokeColor3 = textLabel.TextStrokeColor3
letterLabel.Parent = textLabel
letterLabel.Visible = false
table.insert(Letters, letterLabel)
table.insert(TextSizeInfo, textSizeInfo)
totalWidth = totalWidth + textSizeInfo.X
end
return Letters, TextSizeInfo
end
The issue is for specific letters like e they have an offset which seems to be dynamic
im unsure of the cause of this issue and would like to know more
Thanks.