Advertisement
trollhackerdude

ui library rewrite

Nov 9th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.91 KB | None | 0 0
  1. -- made by troll, based off of wallys ui library but more compatible with free exploits.
  2.  
  3. -- Organic Milk#6128
  4.  
  5. local lib = {
  6.     windowcount = 0;
  7.     counter = 0;
  8. }
  9.  
  10. local ScreenGui = Instance.new("ScreenGui")
  11.  
  12. function lib:CreateWindow(options)
  13.     options = options or { }
  14.    
  15.     self.counter = self.counter + 1
  16.    
  17.     if self.counter > 1 then
  18.         self.windowcount = self.windowcount + 1
  19.     end
  20.    
  21.     local window = {count = 0}
  22.    
  23.     local Frame = Instance.new("Frame")
  24.     local TextLabel = Instance.new("TextLabel")
  25.    
  26.     --Properties:
  27.    
  28.     ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  29.     ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  30.    
  31.     Frame.Parent = ScreenGui
  32.     Frame.BackgroundColor3 = Color3.new(0, 0, 0)
  33.     Frame.Size = UDim2.new(0, 150, 0, 60)
  34.     Frame.Name = options.text or "window"
  35.     Frame.Position = UDim2.new(0.191 * self.windowcount,0,0,0)
  36.    
  37.     TextLabel.Parent = Frame
  38.     TextLabel.BackgroundColor3 = Color3.new(0, 0, 0)
  39.     TextLabel.BorderColor3 = Color3.new(0.133333, 1, 0.0235294)
  40.     TextLabel.BorderSizePixel = 2
  41.     TextLabel.Size = UDim2.new(0, 150, 0, 30)
  42.     TextLabel.Font = Enum.Font.GothamSemibold
  43.     TextLabel.TextColor3 = Color3.new(1, 1, 1)
  44.     TextLabel.TextSize = 14
  45.     TextLabel.Text = options.text or "window"
  46.    
  47.     function window:AddButton(name, exe)
  48.         self.count = self.count + 1
  49.         Frame.Size = UDim2.new(0, 150,0, 40 + 40 * self.count)
  50.         local TextButton = Instance.new("TextButton")
  51.         TextButton.Parent = Frame
  52.         TextButton.BackgroundColor3 = Color3.new(1, 1, 1)
  53.         TextButton.BackgroundTransparency = 1
  54.         TextButton.Position = UDim2.new(0, 5, 0, ((45 * self.count) - 20) + 5)
  55.         TextButton.Size = UDim2.new(0, 150, 0, 30)
  56.         TextButton.Font = Enum.Font.GothamSemibold
  57.         TextButton.TextColor3 = Color3.new(1, 1, 1)
  58.         TextButton.TextSize = 14
  59.         TextButton.Text = name
  60.        
  61.         exe = exe or function() end
  62.        
  63.         TextButton.MouseButton1Click:Connect(exe)
  64.     end
  65.    
  66.     function window:AddToggle(name, exe)
  67.         exe = exe or function() end
  68.        
  69.         local toggle = false
  70.        
  71.         self.count = self.count + 1
  72.         Frame.Size = UDim2.new(0, 150,0, 40 + 40 * self.count)
  73.         local TextButton = Instance.new("TextButton")
  74.         TextButton.Parent = Frame
  75.         TextButton.BackgroundColor3 = Color3.new(1, 0, 0)
  76.         TextButton.BackgroundTransparency = 1
  77.         TextButton.Position = UDim2.new(0, 5, 0, ((45 * self.count) - 20) + 5)
  78.         TextButton.Size = UDim2.new(0, 150, 0, 30)
  79.         TextButton.Font = Enum.Font.GothamSemibold
  80.         TextButton.TextColor3 = Color3.new(1, 0, 0)
  81.         TextButton.TextSize = 14
  82.         TextButton.Text = name..": OFF"
  83.        
  84.         TextButton.MouseButton1Click:Connect(function()
  85.             if toggle == true then
  86.                 toggle = false
  87.             else
  88.                 toggle = true
  89.             end
  90.             if toggle == true then
  91.                 TextButton.TextColor3 = Color3.new(0,1,0)
  92.                 TextButton.Text = name..": ON"
  93.             else
  94.                 TextButton.TextColor3 = Color3.new(1,0,0)
  95.                 TextButton.Text = name..": OFF"
  96.             end
  97.             exe(toggle)
  98.         end)
  99.     end
  100.     return window
  101. end
  102.  
  103. return lib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement