TextBox How to keep the same text size for every screen resolution?

Can’t you just enable TextScaled?

Yeah I could do that, but then it will have the text fit in the whole size of the TextBox like this :

174d116a68b21525bca6c7a0c2456de4112fe47d

instead of this :

bcdb6498229588f667b5ca709a2008852c50780f

1 Like

Sorry about that, I should have read all the replies more carefully.

I think you could utilise TextBox.AbsoluteSize. If you set the TextBox’s size with scale, you can multiply it by a number to set the size based on resolution. Depending on whether you want the same height or width, it would work like this:

TextBox.TextSize = TextBox.AbsoluteSize.X * MagicNumber

or

TextBox.TextSize = TextBox.AbsoluteSize.Y * MagicNumber

I tested this in Studio and it seems to work.

26 Likes

I’ll definitely try this and let you know!

EDIT :

Worked! Thank you :heart:

1 Like

Sorry for responding so late. But how would you get the MagicNumber? Could you maybe give an example?

It depends on your situation! You’ll only need it if you don’t want TextSize to equal AbsoluteSize. Rather, if you need smallish text in comparison to the size of its TextBox, you might replace MagicNumber with 0.3.

2 Likes

I’ve never been able to find a solution to this problem, always ended up having to re enable TextScaled and then just have a character limit, this works perfectly, thank you!