the label text on surface gui wont change to the number typed into the textbox, which has to be one of the numbers in the table, please help.
01 | local tbl = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 , 29 , 30 , 31 , 32 , 33 , 34 , 35 , 36 , 37 , 38 , 39 , 40 , 41 , 42 , 43 , 44 , 45 , 46 , 47 , 48 , 49 , 50 , 51 , 52 , 53 , 54 , 55 , 56 , 57 , 58 , 59 , 60 , 61 , 62 , 63 , 64 , 65 , 66 , 67 , 68 , 69 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 80 , 81 , 82 , 83 , 84 , 85 , 86 , 87 , 88 , 89 , 90 , 91 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 } |
02 | plr = script.Parent.Parent.Parent.Parent.Parent |
03 | char = plr.Character |
04 | vl = Instance.new( "SurfaceGui" , char.Torso) |
05 | vll = Instance.new( "Frame" , vl) |
06 | vlll = Instance.new( "TextLabel" , vll) |
07 | vll.Size = UDim 2. new( 0 , 800 , 0 , 600 ) |
08 | vll.Transparency = 1 |
09 | vlll.FontSize = "Size96" |
10 | script.Parent.MouseButton 1 Down:connect( function () |
11 | for i,v in pairs (tbl) do |
12 | if script.Parent.Parent.NumberHere.Text = = v then |
13 | vlll.Text = v |
14 | end |
15 | end |
16 | end ) |
?
Ok, there are a few flaws in this. Firstly, your table gets cut off, secondly, there is this magic function called tonumber.
01 | local max = 20 --change this to the biggest number in the table |
02 |
03 | script.Parent.MouseButton 1 Click:connect( function () |
04 | local num = script.Parent.Parent.NumberHere.Text |
05 | if tonumber (num) then --check if it's a num |
06 | if tonumber (num)< = max then --check if it's under the max |
07 | vlll.Text = num |
08 | end |
09 | end |
10 | end ) |