Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.39 KB | None | 0 0
  1. local makeInventoryGrids = {}
  2.  
  3. function makeInventoryGrids:Create(size,name,sizeInPixels,position,parent)
  4.     --//Grid Lines math and bar math
  5.     local barsizeY = 30/sizeInPixels -- so if it was 30/90 size would be 0.3333
  6.     local startingPointY = 30/sizeInPixels
  7.     local endingPointY = sizeInPixels/30-1
  8.     --//Create Grid
  9.     local frame = Instance.new('Frame')
  10.     local bar = Instance.new('Frame')
  11.     local xGrid = Instance.new('Frame')
  12.     local yGrid = Instance.new('Frame')
  13.     frame.Name = 'ContainerGrid'
  14.     bar.Name = 'Bar'
  15.     xGrid.Name = 'XGrid'
  16.     yGrid.Name = 'YGrid'
  17.     frame.Size = size
  18.     frame.Position = position
  19.     frame.BackgroundColor3 = Color3.fromRGB(255,255,255)
  20.     frame.BackgroundTransparency = .8
  21.     frame.BorderSizePixel = 0
  22.     xGrid.Size = UDim2.new(1,0,0,1)
  23.     xGrid.BorderSizePixel = 0
  24.     xGrid.BackgroundTransparency = .7
  25.     xGrid.BackgroundColor3 = Color3.fromRGB(255,255,255)
  26.    
  27.     yGrid.Size = UDim2.new(0,1,1,0)
  28.     yGrid.BackgroundColor3 = Color3.fromRGB(255,255,255)
  29.     yGrid.BorderSizePixel = 0
  30.     yGrid.BackgroundTransparency = .7
  31.     --//CreateBar and contents in it
  32.     bar.Size = UDim2.new(1,0,barsizeY,0)
  33.     bar.Position = UDim2.new(0,0,-barsizeY,0)
  34.     bar.BorderSizePixel = 0
  35.     bar.BackgroundColor3 = Color3.fromRGB(31,31,31)
  36.     local button = Instance.new('TextButton')
  37.     button.BackgroundColor3 = Color3.fromRGB(255,255,255)
  38.     button.BackgroundTransparency = .4
  39.     button.BorderSizePixel = 0
  40.     button.Size = UDim2.new(0.1,0,1,0)
  41.     button.TextScaled = true
  42.     button.TextColor3 = Color3.fromRGB(255,255,255)
  43.     button.Text = '-'-- will alternate
  44.     local text = Instance.new('TextLabel')
  45.     text.AnchorPoint = Vector2.new(0,0)
  46.     text.Position = UDim2.new(0.1,0,0,0)
  47.     text.Size = UDim2.new(.9,0,1,0)
  48.     text.BackgroundColor3 = Color3.fromRGB(255,255,255)
  49.     text.TextColor3 = Color3.fromRGB(255,255,255)
  50.     text.TextXAlignment = Enum.TextXAlignment.Left
  51.     text.TextScaled = true
  52.     text.BackgroundTransparency = .9
  53.     text.BorderSizePixel = 0
  54.     text.Text = tostring(name)
  55.     text.Parent = bar
  56.     button.Parent = bar
  57.     bar.Parent = frame
  58.     frame.Parent = parent
  59.     --//Create Grids
  60.     --//XGridsCreate
  61.     for i = startingPointY,startingPointY*endingPointY,startingPointY do
  62.         local cloneOfXGrid = xGrid:Clone()
  63.         cloneOfXGrid.AnchorPoint = Vector2.new(0,i)
  64.         cloneOfXGrid.Position = UDim2.new(0,0,i,0)
  65.         cloneOfXGrid.Parent = frame
  66.     end
  67.     return frame,sizeInPixels
  68. end
  69.  
  70.  
  71. --[[
  72.     Algorithms:
  73.     (.033 +.033 * 3)+.001
  74. --]]
  75. return makeInventoryGrids
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement