|
| 01 Jan 2015 09:35 AM |
Hello everyone,
Im trying to make a Shop GUI, I know I can manually make each shop item but, I was wondering if I could make an easier way. So heres the idea, basically I would have a table storing each shop item, this would include data such as: Name, Price, PictureID, Description, and a boolean value to check if they have it. So, if I wanted to make 3 new products, I would simply enter the information about the product into the table. Then maybe iterate through the table and create the items card. Any ideas on how to do this (Not scripts, I would like to do this on my own)?
Thanks in advance,
|
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 01 Jan 2015 09:37 AM |
for k,v in pairs(script:GetChildren()) do local image = "rbxassetid://"..v.ID.Value-1; local Name = v.Name; local Price = v.Price.Value -- Do stuff end
Like that? |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 09:44 AM |
Hi,
Well you see, I already knew about that but, the problem I`ve been facing is that I have been using a Scrolling Frame. So they would stack on each other. I would like them to go next to each other, and if they reach the end of te canvas, it would expand. On the other hand, if I manually expanded the canvas size then the cards would be spread out. Plus, do you know any ways on how to make a table store multiple values? |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 09:56 AM |
| Not only that but also, instead of creating a table (if there wasn't a way) then could I use a method of creating a model which would act as the table, then create another model which would be the ID of the product, and inside that would be values. |
|
|
| Report Abuse |
|
|
| |
|
vacharya
|
  |
| Joined: 06 Jan 2011 |
| Total Posts: 511 |
|
|
| 01 Jan 2015 11:02 AM |
Set a height then for every new item generated keep adding to that height so the item is relatively lower in the scrolling frame then the top item was.. itemHolder.Position = UDim2.new(0,0,Height+0.1,0) Height = Height+0.1 :) |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 11:04 AM |
um..yeah
I created a leaderboard using scrolling frame and I have to make an algebraic function and then convert it to an algorithm. two, actually. it was kinda confusing a took a good while. I don't know how to explain it, just try your best. get out a piece of paper or something and a calculator and draw out the problem, and see what you can do. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 11:05 AM |
| sorry for my bad grammar, I don't know what is wrong with me.. o.o |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 11:08 AM |
game.ReplicatedStorage.LeaderboardServer.SendNewLBData.OnClientEvent:connect(function(data) script.Parent.Main.ScrollingFrame:ClearAllChildren() local j = 0 for index, value in pairs(data) do j = j + 1 newbox = game.ReplicatedStorage.DisplayBoard:Clone() newbox.Username.Text = index newbox.Level.Text = "Level " .. value["Level"] local currentboxes = script.Parent.Main.ScrollingFrame:GetChildren() if #currentboxes > 3 then script.Parent.Main.ScrollingFrame.CanvasSize = UDim2.new(1, 0, j * 0.3, 0) newbox.Size = UDim2.new(1, 0, 1/j, 0) newbox.Position = UDim2.new(0, 0, (j * 1/j) - 1/j, 0) for i = 1, #currentboxes do currentboxes[i].Size = UDim2.new(1, 0, 1/j, 0) currentboxes[i].Position = UDim2.new(0, 0, (i * 1/j) - 1/j, 0) end else newbox.Size = UDim2.new(1, 0, 0.33, 0) newbox.Position = UDim2.new(0, 0, (j * 0.33) - 0.33, 0) end newbox.Parent = script.Parent.Main.ScrollingFrame end end) |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 11:52 AM |
| Thanks! That really helped, but what about when it reaches the end of the Scrolling Frame? Resizing it won't do anything. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 12:31 PM |
| Because since the position is the area of canvas. Even if the canvas is like times 2 the size, the Items will just be more spread out. |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 01:48 PM |
| Ideas on resizing the canvas? |
|
|
| Report Abuse |
|
|