Letter [M, N] text bound inaccuracy problem

  1. What do you want to achieve? Keep it simple and clear!
    I want to achieve an effect where each letter is created and gets tweened 20 pixels off and with no transparency. While I’ve had a surprising amount of success with this, there’s a very odd problem occuring whenever it experiences letters such as M or N.

  2. What is the issue? Include screenshots / videos if possible!
    All letters but M and N have an accurate horizontal text bound.


    As you can see, the “I” in “IN” is completely obstructed by the letter N as well as spacing between each “M” is inaccurate except when its next to the same letter.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried using the TextLabel’s TextBound property instead of TextService:GetTextSize with no luck. No post on the DevForum demonstrates this issue either.

Here’s the code for the text tweener function:

local textOffset, initialOffset = 0, 20
local function TweenText(parent, text, properties)
	local label = Instance.new("TextLabel")
	for i, v in next, properties do
		pcall(function()
			label[i] = v
		end)
	end
	label.AnchorPoint = Vector2.new(0.5, 0.5)
	label.Size = UDim2.new(0, 0, 1, 0)
	label.Text = ""
	label.TextStrokeTransparency = 1
	label.TextTransparency = 1
	
	local currPos = -(GetTextBounds(text, label.TextSize, label.Font).X + (textOffset/2)*#text)/2
	for i = 1, #text do
		local labelClone = label:Clone()
		labelClone.Parent = parent
		labelClone.Position = UDim2.new(0.5, currPos - initialOffset, 0.5, 0)
		labelClone.Text = text:sub(i, i)
		currPos += labelClone.TextBounds.X
		
		TweenTransparency(labelClone, 0); Tween(labelClone, TweenInfo.new(TweenSettings.Time, TweenSettings.Style, TweenSettings.Direction), {Position = labelClone.Position + UDim2.new(0, initialOffset, 0, 0)})
		wait(0.075)
	end
end
1 Like

Nevermind, setting the AnchorPoint to Vector2.new(0, 0.5) and updating the size of the label fixed the issue.