How to change text to a value and text

I simply need to have is so that the text is set to a value then % after it
I’m making this for a fnaf power system

For Example of what i have:
PowerLeftText.Text = PowerLeft.Value

Example of what i need:

PowerLeftText.Text = PowerLeft.Value"%"

Like how you can print (PowerLeft.Value, “%”) but that wont work for some reason

2 Likes

try

TextLabel.Text = 'i lo'..'ve @Qi'..'n2007'

the text would be ‘i love @Qin2007

its simple

PowerLeftText.Text = tostring(PowerLeft.Value).."%"

Using .. in strings connects two of them together.

It doesn’t work because with this:

print(20.."%")

you are trying to join a number with a string, to fix that you need to do “tostring()”
EXAMPLE:

print(tostring(20).."%")

Check my other comment

1 Like

Stating that the opcode OP_CONCAT on VM number and string doesn’t work is factually incorrect. Calling luaV_tostring on VM number doesn’t do anything.

Executing the concatenation opcode on strings and/or numbers is just fine, if you looks at the source code, you’ll see this.
https://www.lua.org/source/5.1/lvm.c.html#luaV_concat

if (!(ttisstring(top-2) || ttisnumber(top-2)) || !tostring(L, top-1)) {
      if (!call_binTM(L, top-2, top-1, top-2, TM_CONCAT))
        luaG_concaterror(L, top-2, top-1);