Changing size of label on text size

Godot 4.5.1

Question

So, im need to automatically change the size of label node in transform, on size of text in the same label
(game is 2d)

You can change the size of a label node with

my_label.size = Vector2(x, y)

If the label is in a container, it may be shrunk to its smallest size possible, in which case you will want to use this instead:

my_label.custom_minimum_size = Vector2(x, y)

If you want to change the font size, you need to change it in my_label.label_settings.font_size, or in a Theme applied to the label.