Advertisement
unknownexploits

uilib test

Aug 18th, 2020 (edited)
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. local uilib = {windows = {}, open = true}
  2.  
  3. function uilib:Create(class, properties)
  4. properties = typeof(properties) == "table" and properties or {}
  5. local inst = Instance.new(class)
  6. for property, value in next, properties do
  7. inst[property] = value
  8. end
  9. return inst
  10. end
  11.  
  12. function createholder(holderTitle, parent, parentTable, subHolder)
  13. local size = subHolder and 35 or 46
  14. parentTable.main = uilib:Create("Frame", {
  15. LayoutOrder = subHolder and parentTable.position or 0,
  16. Position = UDim2.new(0, 20 + (250 * (parentTable.position or 0)), 0, 20),
  17. Size = UDim2.new(0, 230, 0, size),
  18. BackgroundTransparency = .5;
  19. ClipsDescendants = true,
  20. Parent = parent
  21. })
  22.  
  23. local title = uilib:Create("TextLabel", {
  24. Size = UDim2.new(1, 0, 0, size),
  25. BackgroundTransparency = subHolder and 0 or 1,
  26. BackgroundColor3 = Color3.fromRGB(10, 10, 10),
  27. BorderSizePixel = 0,
  28. Text = holderTitle,
  29. TextSize = subHolder and 16 or 17,
  30. Font = Enum.Font.GothamBold,
  31. TextColor3 = Color3.fromRGB(255, 255, 255),
  32. Parent = parentTable.main
  33. })
  34. end
  35.  
  36. local function loadOptions(option, holder)
  37. for _,newOption in next, option.options do
  38. --[[ if newOption.type == "label" then
  39. createLabel(newOption, option)
  40. elseif newOption.type == "toggle" then
  41. createToggle(newOption, option)
  42. elseif newOption.type == "button" then
  43. createButton(newOption, option)
  44. elseif newOption.type == "list" then
  45. createList(newOption, option, holder)
  46. elseif newOption.type == "box" then
  47. createBox(newOption, option)
  48. elseif newOption.type == "bind" then
  49. createBind(newOption, option)
  50. elseif newOption.type == "slider" then
  51. createSlider(newOption, option)
  52. elseif newOption.type == "color" then
  53. createColor(newOption, option, holder)
  54. elseif newOption.type == "folder" then
  55. newOption:init()
  56. end]]
  57. end
  58. end
  59.  
  60. function uilib:CreateWindow(title)
  61. local window = {title = tostring(title), options = {}, open = true, canInit = true, init = false, position = #self.windows}
  62.  
  63. table.insert(uilib.windows, window)
  64.  
  65. return window
  66. end
  67.  
  68. function uilib:Init()
  69. self.base = self.base or self:Create("ScreenGui")
  70.  
  71. if syn and syn.protect_gui then
  72. syn.protect_gui(self.base)
  73. elseif get_hidden_gui then
  74. get_hidden_gui(self.base)
  75. else
  76. game:GetService"Players".LocalPlayer:Kick("Error: protect_gui function not found")
  77. return
  78. end
  79. self.base.Parent = game.Players.LocalPlayer.PlayerGui
  80. self.base.Name = "uwuware"
  81.  
  82. for _, window in next, self.windows do
  83. if window.canInit and not window.init then
  84. window.init = true
  85. createholder(window.title, self.base, window)
  86. --loadOptions(window)
  87. end
  88. end
  89. end
  90.  
  91. return uilib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement