I have a StringValue with a newline in it, but when I set a TextLabel’s Text to it, it doesn’t register, and instead just puts it as part of the text, any ideas?
We cannot help you debug an issue with your code if you do not provide us with the code you’re running. The example that you have provided will error on the first line due to invalid syntax.
If I am correct, I believe you’re setting the Value property using the property editor widget and not from with Lua. If this is the case then the Value property will actually be
Test \\nTest
When setting the Text property of your TextLabel, you will see
Test \nTest
This all occurs due to character escaping. When you write \n in the property widget, the \ needs to be escaped so that it is displayed correctly by UI elements. Hence why you end up with \\n for the actual string.
Figured out you can repro it by manually typing test \ntest into the value property. Manually assigning the value within the properties window doesn’t produce the same result as assigning it via the command bar or a script instance.
vs
edit: accidentally replied to response instead of op
Just saying that the whitespace in that string will be counted. Starting a line break at the beginning of the quote will show up. Your code will have the tabs showing up as well.
You can write your block strings without whitespace or construct them using concatenation.
local stringBlock = [[Hello.
This is a block string.
Bye.
]]
local stringConcat = "Hello."
.. "\nThis is a concatenated string."
.. "\nBye."