You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I essentially want to put a % symbol before a numbervalue.
-
What is the issue? Include screenshots / videos if possible!
I don’t know how to because I have 1 month of experience and somehow havent found an answer.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes, I’ve tried
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
3 Likes
If you want to convert a interger to a string, you could use tostring()
5 Likes
Can you give me an example on this?
1 Like
You can combine a % symbol with the NumberValue number like so:
Percent = "%" .. tostring(NumberValue.Value) --use the .. operator to combine the two values
14 Likes
Here’s an example:
local number = 9
local string = tostring(number)
3 Likes
Ahhh ok I got it and also same for Eduardo’s example
3 Likes
What the function looks like
// LuaGlobal
string tostring(Variant e);
/*
Receives an argument of any type and converts it to a string in a reasonable format.
For complete control of how numbers are converted, use string.format.
If the metatable of e has a __tostring metamethod, then it will be called with e as the only argument and will return the result.
*/
An example
local x = 1
print(typeof(x)) -- int
x = tostring(x)
print(typeof(x)) -- string
2 Likes
Ok thanks (30 Characters needed)