I have an integer value, and I need to convert the numbers it displays into a string to show it on a GUI. Any idea how?
[EDIT] My script
while true do script.Parent.Text = game.Workspace.Shields.Value + "%" wait(0.1) end
If I'm correct, you'd use the tostring
method to convert a number or integer to a string.
while true do script.Parent.Text = tostring(game.Workspace.Shields.Value .. "%") -- use tostring method to convert integer to string wait(0.1) end
By the way, to combine 2 strings/integers, use ..
instead of +
, because +
makes the script try to add 2 values. You can't add a string + a number.
You can do this one of two ways.
Calling the function tostring
on the number
x = tostring(number) print(x)
Concatenation
x = 5 print("High"..x) --> "High5"