Advertisement
HiDad910

it

Jul 12th, 2022 (edited)
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.72 KB | None | 0 0
  1.  
  2. local lib = {}
  3.  
  4. -- Create a new frame
  5. function lib.Frame.new()
  6.     local self = {}
  7.  
  8.     self.GuiObject = Instance.new("Frame")
  9.     self.GuiObject.BackgroundColor3 = Color3.new(1, 1, 1)
  10.     self.GuiObject.BackgroundTransparency = 0.5
  11.     self.GuiObject.BorderColor3 = Color3.new(0, 0, 0)
  12.     self.GuiObject.BorderSizePixel = 2
  13.     self.GuiObject.Position = UDim2.new(0.5, -125, 0.5, -100)
  14.     self.GuiObject.Size = UDim2.new(0, 250, 0, 200)
  15.  
  16.     -- Ready the GUI for rendering
  17.     function self:Ready()
  18.         self.GuiObject.Name = "SynGUI_" .. tostring(self)
  19.     end
  20.  
  21.     -- Resize the GUI
  22.     function self:Resize()
  23.         self.GuiObject.Size = UDim2.new(0, 250, 0, 200)
  24.     end
  25.  
  26.     -- Render the GUI
  27.     function self:Render()
  28.         self.GuiObject.Parent = game:GetService("CoreGui")
  29.     end
  30.  
  31.     return self
  32. end
  33.  
  34. -- Create a new button
  35. function lib.Button.new(parent, text)
  36.     local self = {}
  37.  
  38.     self.GuiObject = Instance.new("TextButton")
  39.     self.GuiObject.BackgroundColor3 = Color3.new(1, 1, 1)
  40.     self.GuiObject.BackgroundTransparency = 0.5
  41.     self.GuiObject.BorderColor3 = Color3.new(0, 0, 0)
  42.     self.GuiObject.BorderSizePixel = 2
  43.     self.GuiObject.Position = UDim2.new(0.5, -50, 0.5, -25)
  44.     self.GuiObject.Size = UDim2.new(0, 100, 0, 50)
  45.     self.GuiObject.Font = Enum.Font.SourceSans
  46.     self.GuiObject.Text = text
  47.     self.GuiObject.TextColor3 = Color3.new(0, 0, 0)
  48.     self.GuiObject.TextSize = 20
  49.  
  50.     -- Connect a function to run when the button is activated
  51.     function self:Connect(event, func)
  52.         self.GuiObject[event]:Connect(func)
  53.     end
  54.  
  55.     -- Parent the button to a GUI frame
  56.     self.GuiObject.Parent = parent.GuiObject
  57.  
  58.     return self
  59. end
  60.  
  61. return lib
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement