How can i make the text size consistant?

image
I tested it in diferent screen sizes and it keeps getting cut of beacuse of the size, i want the size to look alike, but not be the same, like:
image
i want the text to be like this in every device
I alredy tried UITextSizeConstraint, but it didn’t seem to work

As far as programming, you can use TextService:GetTextSize to programmatically scale the text to a desired actual pixel size.

Apart from that, you can put the text inside a frame, control the size of the frame to be what you want, then set the text to TextScaled. This way, the size of the text is determined by the size of the frame, which is easy to control using scale and UIAspectRatioConstraints.

1 Like

image
image
i just tought that to consist this lines thing it would be better just do multiple text labels as diferent lines, it would be easyer, and im using the uiSizeConstraint to keep the size of the back frame consistant
image

1 Like

i’ve been thinking a bit about what you said, and i came up with this script, it works, so i will keep it for now

local TextService = game:GetService("TextService")
local RunService = game:GetService("RunService")
local TextSize = script.Parent.TextSize
RunService.Heartbeat:Connect(function()
	local NewTextSize = TextService:GetTextSize(script.Parent.Text,TextSize,Enum.Font.Arcade,script.Parent.Parent.AbsoluteSize)
	local NewSize = UDim2.new(NewTextSize.X/script.Parent.Parent.AbsoluteSize.X,0,NewTextSize.Y/script.Parent.Parent.AbsoluteSize.Y,0)
	script.Parent.Size = NewSize
end)
1 Like

You can also connect this to workspace.CurrentCamera:GetPropertyChangedSignal("ViewportSize") to make it slightly more efficient (but also make sure to have an initial size update).

Edit: (Assuming that the parent’s UDim2 size isn’t changing.)

1 Like