How to change the size of a TextLabel through a script?

I’ve been trying to change the size of my TextLabel through a script, but I have no idea how to do that.

Any help?

1 Like
TextLabel.TextSize = 10 --example

Edit: This only works if TextScaled is set to false

2 Likes

Thank you so much!

Edit: Doesn’t work

In a LocalScript do

TextLabel.Size = UDim2.new(sizeXScale, sizeXOffset, sizeYScale, sizeYOffset)

TextLabel should be replaced with either a variable referencing the TextLabel instance or just a hard-coded path directly to the TextLabel.

Another thing, everything created in StarterGui is cloned to a folder inside a player called “PlayerGui”, so any changes you want to make to said player’s UI will need to occur through those UI instances (ones located inside PlayerGui) and not the ones inside StarterGui.

If you’re only trying to change the text of a TextLabel, then the easiest thing to do would be to just put a LocalScript inside the TextLabel and do

script.Parent.Size

4 Likes

Thank you so much!

It really works:)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.