Is it possible to get numbers from a table and put them on a textlabel? I tried to set the text as the table but it says in the output
Unable to assign property Text. string expected, got table
Is it possible to get numbers from a table and put them on a textlabel? I tried to set the text as the table but it says in the output
Unable to assign property Text. string expected, got table
Use tostring()
tostring(number)
Sorry lol. Is it possible to get the contents from it? like 1,2,3,4 and their values?
Use a for loop to get the variable inside the table
I did that, It worked but like not how I expected it too, It got the number I was pressing but it didnt get the contents of the table. Here is a picture of the table btw
What I was hoping it’d be like is 000000000
for loops have two variables, index and value. Use the Value instead of the Index
I tried both but it didnt work
Why not remove the replacement of the index? All you do is replace [1] with [“1”] and etc. I guess you can just replace that and make your table look like this:
local numbers = {
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
}
Then just get the value and you should be good
Try doing textlabel.Text = table.unpack(yourTable)
Lemme ellaborate more.
Im making a phone system in my game
Simple,
local finalString = ''
for index, value in pairs(number) do
finalString.. = tostring(value)
end
yourLabel.Text = finalString
This will add the value to the string each time. Simply set the textLabel’s text to finalString.
Sorry to ask but what is finalstring in this instance?
The final string of all your numbers.
no, you need “…=” instead of “=” (you used finalString = tostring(value), it needs to be finalString…= tostring(value))
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.