of     1   

darkemosoul
#141798436Monday, July 28, 2014 3:16 AM GMT

Im trying to make a gui that creates buttons for each of its children. But I am puzzled because im trying to figure out a way to create buttons but after a certain row the y offset moves down and x offset resets. Any ideas? The y formula works perfectly i think, but I have no ideas on how to make x return to one. heres part of the script: for i=1, (#units) do local z = Instance.new("TextButton",SelectionFrame)-- Dont worry about this z.Name = units[i].Name -- or this decode = Utils.DecodeJSON(units[i].Value) -- or this z.Text = decode[3] -- or this z.Size = UDim2.new(0, 32, 0, 32) -- or this newYPos = i <= 16 and 2 or math.floor(i/16)*(34) newXPos = i == 1 and 2 or 2+(34*((i/math.ceil(i/16))-(i <= 16 and 1 or 0))) print(newXPos, math.ceil(i/16), i/math.ceil(i/16),i) z.Position = UDim2.new(0, newXPos, 0, newYPos ) end
darkemosoul
#141798599Monday, July 28, 2014 3:18 AM GMT

Bump Please HELP!!
MomoiroCloverZ
#141798906Monday, July 28, 2014 3:21 AM GMT

for i=1, (#units) do newYPos = math.floor(i/16)*(34)+2 newXPos = 2+(i-1)%16*30 z.Position = UDim2.new(0, newXPos, 0, newYPos ) end MomoiroCloverZ, newbag expert Lua coder.
darkemosoul
#141799841Monday, July 28, 2014 3:29 AM GMT

Wow you make it seem so simple I have been doing this for hours. I tested your code out, it works perfectly until the next row(kinda) At the last x Position for row 1 moves down and then it works again and repeats. Example: Button;Button;Button;Button;Button;Button;Button;Button;Button;Button;Button; Button;Button;Button; Button; That's what it looks like, i am beginning to think this is almost impossible!!
darkemosoul
#141799992Monday, July 28, 2014 3:30 AM GMT

Fail it didnt come out right let me redo the buttons Button;Button;Button;Button;Button;Button;Button;Button; Button;Button; iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii Button; ignore the i's and imagine they are nothing!
darkemosoul
#141800135Monday, July 28, 2014 3:31 AM GMT

Still failed basicly the last button moves down but then after that it works and it repeats itself.
MomoiroCloverZ
#141800353Monday, July 28, 2014 3:33 AM GMT

newYPos = math.floor((i-1)/16)*(34)+2 MomoiroCloverZ, newbag expert Lua coder.
darkemosoul
#141800582Monday, July 28, 2014 3:35 AM GMT

I LOVE YOU THANKS!!!! IT WORKS!!! After hours of work you did it in a couple seconds... THANKS!!!
MomoiroCloverZ
#141801657Monday, July 28, 2014 3:45 AM GMT

np its cause i use it all the time MomoiroCloverZ, newbag expert Lua coder.

    of     1