How do I make a label two lines in script?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Adam_Grace

So I’m trying to change what a label says through script, but it overlaps some other parts of my game but I don’t know how to make a new text line in script.

For example:

$Node2D/HSplitContainer/Hair/HairButtons/Label.text = "Coleur de Cheveux"

Overlaps part of the game which needs to be shown. Is there a way to make it appear like this in the editor?

Coleur de
:bust_in_silhouette: Reply From: Calinou

The \n escape sequence allows you to write a line break in a string.

Here, you’d need to use the following syntax:

$Node2D/HSplitContainer/Hair/HairButtons/Label.text = "Coleur de\n Cheveux"

Thanks for the response! Worked perfectly! Now it’ll be a lot easier to translate from English :slight_smile:

Adam_Grace | 2022-07-19 15:23