How to fix text scaling smaller when text length gets long

I’ve made a dialogue system but I am across a problem with text scaling

as you see when the text gets long, it starts to scale smaller

how would I fix this? I want the text to keep the same size

disable TextLabel.TextScaled

oh that kind of fixed it but now the text is clipping out of the frame

image

I think you’d need to disable the property ClipsDescendants for the full text to be rendered,

otherwise, I’d suggest making the average textlabel/frame big enough that the text will not shrink in size while centered but will fill out the whole textlabel instead

use \n

example:

local function TweenText(Object : TextButton | TextLabel | TextBox, Text : string, Time : number)
	if not Object:IsA("TextButton") and not Object:IsA("TextBox") and not Object:IsA("TextLabel") then
		return "no"
	end
	
	local StartTime = tick()
	local TimeBetween =  Time / (string.len(Text))
	Object.Text = ""

	local Amount = 0

	for i=1, string.len(Text) do
		if Amount > 30 and string.sub(Text, i, i) == " " then
			Object.Text = Object.Text .. "\n"
			Amount = 0
		end

		Amount += 1
		Object.Text = Object.Text .. string.sub(Text, i, i)

		if i ~= 1 then
			task.wait(TimeBetween)
		end
	end
	
	return tick() - StartTime
end

I did that but it aint working, the text is now smashing together depending on how close the camera is

what does that do? (30chararterss)

It linesplits the text so that you have a new row of text if the amount of letters exceeds 20, and the text is tweened as well

oh ok ill try it (30 dhacharacters)

uhh its being wierd now

heres my code where Im calling the function

			local textString = chat.Text[self.CurrentChoice]

			for i = 1, #textString do
				local textLabel = self.DialogueGui.TextLabel
				textLabel.Text = string.sub(textString, 1, i)
				TweenText(textLabel, textString, 0)
				task.wait()
			end

dont tween the text inside your own text tween

local textString = chat.Text[self.CurrentChoice]

TweenText(textLabel, textString, 1)

ohhh LOL (30 chawdawdrgsstersss)

okay it kind of works, it strinked the text and made 3 lines in total

is it because maybe my textlabel is too small? does it have to be a certain size cause rn the size is {1, 0},{0.2, 0}

I’ve edited my post because I found the mistake, I didn’t set the Amount to 0, try it again

oh okay nice, so the text is still strinking

Edit: I see that your checking if the amount is higher then 30, so if lowering that, would it fix the issue? but could it some how be changed depending on the text label size, if that made sense

yes, you could change 30 to a lower number

oh well changing it to a lower number makes it all crumble together, and the reason why it was strinking is cause I didnt have the textlabel full size

but now I need to make it smooth cause this is how its moving

Edit: now that i think about it i should try making the textlabel bigger on the x

Okay I have it working now, I just need to make adjustments to the gui and that’s all, thanks for your help and for taking the time to write code to help me