Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Help with Instances and tables?

Asked by 10 years ago

I just want one value to go in a text box,but I get all six values in a text box. For example,I want text box 1 to just have the value of 1 and text box 2 to have the value of 2.


-------------Table------------- names = {"yo","2","3","4","5","6" }--The names values = {"13123","1232","3123","1234","1235","612312"}--The values ----ScrollingFrame Creation----- s = Instance.new("ScrollingFrame",script.Parent)--Makes the ScrollingFrame s.Position = UDim2.new(0,50,0,30) s.Size = UDim2.new(0,700,0,540) s.CanvasSize = UDim2.new(0,0,6,6) ----TextButton Table Creation----- for i,v in pairs (names) do print(v)--Test Test h = Instance.new("TextButton",s)--Puts it all in the ScrollingFrame h. Text = v h.Name = v h.Size = UDim2.new(0,100,0,100) ------Value Creation-------------- for x,n in pairs (values) do str = Instance.new("StringValue",h) str.Name = values[x] str.Value = values[x] end ----TextButton Sorting------------ h.Position = UDim2.new(0, 0, 0, (i*100)-100)--For each name move up one end
0
Edited because I forgot to put the values. kevinnight45 550 — 10y

1 answer

Log in to vote
1
Answered by
wazap 100
10 years ago
-------------Table-------------
names = {"1","2","3","4","5","6" }--The names
values = {"1","2","3","4","5","6"}--The values
----ScrollingFrame Creation-----
s = Instance.new("ScrollingFrame",script.Parent)--Makes the ScrollingFrame
s.Position = UDim2.new(0,50,0,30)
s.Size = UDim2.new(0,700,0,540)
s.CanvasSize = UDim2.new(0,0,6,6)
----TextButton Table Creation-----
for i,v in pairs (names) do
print(v)--Test Test
h = Instance.new("TextButton",s)--Puts it all in the ScrollingFrame
h. Text = v
h.Name = v
h.Size = UDim2.new(0,100,0,100)
------Value Creation--------------
str = Instance.new("StringValue",h)
str.Name = values[i]
  str.Value = values[i]
----TextButton Sorting------------
 h.Position = UDim2.new(0, 0, 0, (i*100)-100)--For each name move up one
end


0
Sorry I edited,but I wanted it to be connected the the table named values not i. kevinnight45 550 — 10y
0
IT ALRDY IS CONNECTED TO THE TABLE NAMED VALUES. I IS A PARAMETER IF YOU DONT KNOW WHAT THIS IS LOOK IT UP ON WIKI wazap 100 — 10y
0
Sorry >.> kevinnight45 550 — 10y
Ad

Answer this question