Advertisement
9_cVv

TechHog's UI-Library V2

Jun 6th, 2021 (edited)
811
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.99 KB | None | 0 0
  1. --locals
  2. local SectionTemplate = nil
  3. local SideBarButtonTemplate = nil
  4. local TotalSections = 0
  5. local Sections = {}
  6. local topbar
  7.  
  8. --functions
  9. function CreateGui(name)
  10.     local t = nil
  11.     local success, err = pcall(function() return game:HttpGet('http://blank.com') end)
  12.     if success then
  13.         t = loadstring(game:HttpGet('https://pastebin.com/raw/C9v6ijxt'))()
  14.     else
  15.         t = loadstring(game:GetService'HttpService':GetAsync('https://pastebin.com/raw/C9v6ijxt'))()
  16.     end
  17.  
  18.     local gui = t[1]
  19.  
  20.     gui.Name = name
  21.     SectionTemplate = t[2]
  22.     SideBarButtonTemplate = t[3]
  23.  
  24.     topbar = t[4]
  25.     topbar.Text = name
  26.  
  27.     return gui
  28. end
  29.  
  30. --main
  31. local fake_gui = {}
  32.  
  33. function fake_gui:CreateGui(guiname)
  34.     local FirstSection = nil
  35.     local Gui = CreateGui(tostring(guiname))
  36.     local fake_section = {}
  37.     local sections = {}
  38.     local close_event = Instance.new'BindableEvent'
  39.  
  40.     function fake_section:GetGui()
  41.         return Gui
  42.     end
  43.     function fake_section:On_Close()
  44.         return close_event
  45.     end
  46.     topbar.closeButton.MouseButton1Click:connect(function() close_event:Fire() end)
  47.     function fake_section:CreateSection(sectionname)
  48.         local section = SectionTemplate:Clone()
  49.         section.Parent = SectionTemplate.Parent
  50.         section.Name = tostring(sectionname)
  51.         section.Visible = true
  52.         table.insert(sections, section)
  53.         if not FirstSection then FirstSection = section section.Position = UDim2.new(0,0,0,0) end
  54.         local sidebarbutton = SideBarButtonTemplate:Clone()
  55.         sidebarbutton.Parent = SideBarButtonTemplate.Parent
  56.         sidebarbutton.Visible = true
  57.         sidebarbutton.Name = tostring(sectionname)
  58.         sidebarbutton.Text = tostring(sectionname)
  59.    
  60.         local fake_object = {}
  61.         function fake_object:CreateButton(buttonname, clickcallback)
  62.             local button = section.buttontemplate:Clone()
  63.             button.Parent = section
  64.             button.Visible = true
  65.             button.Name = tostring(buttonname)
  66.             button.Text = tostring(buttonname)
  67.             if clickcallback then
  68.                 button.MouseButton1Click:connect(clickcallback)
  69.             end
  70.             return button
  71.         end
  72.         function fake_object:CreateLabel(labelname)
  73.             local label = section.labeltemplate:Clone()
  74.             label.Parent = section
  75.             label.Visible = true
  76.             label.Name = tostring(labelname)
  77.             label.Text = tostring(labelname)
  78.             return label
  79.         end
  80.         function fake_object:CreateTextBox(boxname)
  81.             local box = section.boxtemplate:Clone()
  82.             box.Parent = section
  83.             box.Visible = true
  84.             box.Name = tostring(boxname)
  85.             box.PlaceholderText = tostring(boxname)
  86.             return box
  87.         end
  88.         table.insert(Sections, section)
  89.         TotalSections += 1
  90.         return fake_object
  91.     end
  92.     return fake_section
  93. end
  94.  
  95. return fake_gui
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement