Vzurxy

Poly's UI Library

Dec 4th, 2019
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 21.02 KB | None | 0 0
  1. local players = game:GetService("Players")
  2. local player = players.LocalPlayer
  3. local character = player.Character
  4. local mouse = player:GetMouse()
  5. local cam = workspace.CurrentCamera
  6. local gui
  7.  
  8. local tween = game:GetService("TweenService")
  9. local run = game:GetService("RunService")
  10. local userinput = game:GetService("UserInputService")
  11. local http = game:GetService("HttpService")
  12.  
  13. local info = TweenInfo.new
  14.  
  15. local ui = {}
  16. local lib = {}
  17. local client = {}
  18.  
  19. do -- UI
  20.     local self = ui
  21.    
  22.     self.menus = {}
  23.     self.index = {}
  24.     self.rainbow = {}
  25.     self.sliders = {}
  26.    
  27.     self.colorminh = 260
  28.     self.colormaxh = 290
  29.     self.colors = 190
  30.     self.colorv = 255
  31.     self.animspeed = 3
  32.    
  33.     local GuiLib = Instance.new("ScreenGui")
  34.     GuiLib.Parent = run:IsStudio() and player.PlayerGui or game.CoreGui
  35.     GuiLib.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  36.     GuiLib.ResetOnSpawn = false
  37.    
  38.     gui = GuiLib
  39.    
  40.     self.updateslider = function(self,name,value)
  41.         local data = self.sliders[name]
  42.         local inc = 1/data.max
  43.        
  44.         local org = ui[name]
  45.         ui[name] = value
  46.        
  47.         tween:Create(data.frame,info(0.2,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Size = UDim2.new(inc*self[name],0,1,0)}):Play()
  48.        
  49.         local function lerp(a, b, t)
  50.             return a + (b - a) * t
  51.         end
  52.  
  53.        
  54.         spawn(function()
  55.             for i = 0,1,0.1 do
  56.                 data.label.Text = data.text .. " | " .. tostring(math.floor(lerp(org,value,i)))
  57.                 run.RenderStepped:wait()
  58.             end
  59.         end)
  60.     end
  61.    
  62.     self.init = function(self,name)
  63.         local Load = Instance.new("Frame")
  64.         local Image = Instance.new("ImageLabel")
  65.         local Zoom = Instance.new("ImageLabel")
  66.         local blur = Instance.new("BlurEffect")
  67.        
  68.         GuiLib.Name = name
  69.        
  70.         Load.Name = "Load"
  71.         Load.Parent = GuiLib
  72.         Load.BackgroundColor3 = Color3.new(1, 1, 1)
  73.         Load.BackgroundTransparency = 1
  74.         Load.ClipsDescendants = true
  75.         Load.Position = UDim2.new(0.410355449, 0, 0.320638835, 0)
  76.         Load.Size = UDim2.new(0,230,0,270)
  77.        
  78.         print(Load.AbsoluteSize)
  79.        
  80.         Image.Name = "Image"
  81.         Image.Parent = Load
  82.         Image.AnchorPoint = Vector2.new(0.5, 0.5)
  83.         Image.BackgroundColor3 = Color3.new(1, 1, 1)
  84.         Image.BackgroundTransparency = 1
  85.         Image.Position = UDim2.new(0.5, 0, 0.5, 0)
  86.         Image.Size = UDim2.new(0, 150, 0, 150)
  87.         Image.Image = "rbxassetid://4458180707"
  88.         Image.ImageTransparency = 1
  89.         Image.ZIndex = 2
  90.        
  91.         Zoom.Name = "Zoom"
  92.         Zoom.Parent = Load
  93.         Zoom.AnchorPoint = Vector2.new(0.5, 0.5)
  94.         Zoom.BackgroundColor3 = Color3.new(1, 1, 1)
  95.         Zoom.BackgroundTransparency = 1
  96.         Zoom.Position = UDim2.new(0.5, 0, 0.5, 0)
  97.         Zoom.Size = UDim2.new(0,0,0,0)
  98.         Zoom.Image = "http://www.roblox.com/asset/?id=631172870"
  99.         Zoom.ImageColor3 = Color3.new(0.27451, 0.27451, 0.27451)
  100.         Zoom.ImageTransparency = 1
  101.        
  102.         blur.Parent = cam
  103.         blur.Size = 0
  104.        
  105.         tween:Create(blur,info(0.2),{Size = 15}):Play()
  106.         tween:Create(Zoom,info(0.2),{Size = UDim2.new(0,150,0,150),ImageTransparency = 0}):Play()
  107.         wait(0.15)
  108.         tween:Create(Image,info(0.2),{ImageTransparency = 0}):Play()
  109.         wait(1.5)
  110.         tween:Create(Image,info(0.2),{ImageTransparency = 1}):Play()
  111.         wait(0.1)
  112.         local size = Load.AbsoluteSize.X * 1.6
  113.         tween:Create(Zoom,info(0.5),{Size = UDim2.new(0,size,0,size),ImageTransparency = 0}):Play()
  114.         wait(0.1)
  115.         local LoadTitle = Instance.new("TextLabel")
  116.         local LoadInfo = Instance.new("TextLabel")
  117.         local LoadBtn = Instance.new("TextButton")
  118.        
  119.         LoadTitle.Name = "LoadTitle"
  120.         LoadTitle.Parent = Load
  121.         LoadTitle.BackgroundColor3 = Color3.fromRGB(55,55,55)
  122.         LoadTitle.BackgroundTransparency = 1
  123.         LoadTitle.BorderSizePixel = 0
  124.         LoadTitle.Size = UDim2.new(1, 0, 0.150000006, 0)
  125.         LoadTitle.Font = Enum.Font.SourceSansBold
  126.         LoadTitle.Text = name
  127.         LoadTitle.TextColor3 = Color3.new(1, 1, 1)
  128.         LoadTitle.TextSize = 32
  129.         LoadTitle.TextTransparency = 1
  130.         LoadTitle.ZIndex = 2
  131.         LoadTitle.TextStrokeTransparency = 1
  132.        
  133.         LoadInfo.Name = "LoadInfo"
  134.         LoadInfo.Parent =Load
  135.         LoadInfo.AnchorPoint = Vector2.new(0.5, 0)
  136.         LoadInfo.BackgroundColor3 = Color3.new(1, 1, 1)
  137.         LoadInfo.BackgroundTransparency = 1
  138.         LoadInfo.Position = UDim2.new(0.50000006, 0, 0.178906575, 0)
  139.         LoadInfo.Size = UDim2.new(0.899999976, 0, 0.517445087, 0)
  140.         LoadInfo.Font = Enum.Font.SourceSansBold
  141.         LoadInfo.Text = "- This is a line \n- This is also a line\n- And me too"
  142.         LoadInfo.TextColor3 = Color3.new(1, 1, 1)
  143.         LoadInfo.TextSize = 24
  144.         LoadInfo.TextXAlignment = Enum.TextXAlignment.Left
  145.         LoadInfo.TextYAlignment = Enum.TextYAlignment.Top
  146.         LoadInfo.TextTransparency = 1
  147.         LoadInfo.ZIndex = 2
  148.         LoadInfo.TextStrokeTransparency = 1
  149.        
  150.         LoadBtn.Name = "LoadBtn"
  151.         LoadBtn.Parent = Load
  152.         LoadBtn.AnchorPoint = Vector2.new(0.5, 0)
  153.         LoadBtn.BackgroundColor3 = Color3.new(0.196078, 0.196078, 0.196078)
  154.         LoadBtn.BorderColor3 = Color3.new(1, 0, 0)
  155.         LoadBtn.BorderSizePixel = 2
  156.         LoadBtn.Position = UDim2.new(0.5, 0, 0.769379139, 0)
  157.         LoadBtn.Size = UDim2.new(0.800000012, 0, 0.150000006, 0)
  158.         LoadBtn.Font = Enum.Font.SourceSansSemibold
  159.         LoadBtn.Text = "Load"
  160.         LoadBtn.TextColor3 = Color3.new(1, 1, 1)
  161.         LoadBtn.TextSize = 32
  162.         LoadBtn.BackgroundTransparency = 1
  163.         LoadBtn.TextTransparency = 1
  164.         LoadBtn.ZIndex = 2
  165.        
  166.         tween:Create(LoadTitle,TweenInfo.new(0.5),{BackgroundTransparency = 1,TextTransparency = 0,TextStrokeTransparency = 0.4}):Play()
  167.         tween:Create(LoadInfo,TweenInfo.new(0.5),{TextTransparency = 0,TextStrokeTransparency = 0.4}):Play()
  168.         tween:Create(LoadBtn,TweenInfo.new(0.5),{BackgroundTransparency = 0,TextTransparency = 0}):Play()
  169.        
  170.         local rs = run.RenderStepped:Connect(function()
  171.             local x = lib:rainbow(tick()/5)
  172.             local color = Color3.fromRGB(176 + (math.sin(tick()) * 48),65,255)
  173.            
  174.             LoadTitle.TextStrokeColor3 = color
  175.             LoadInfo.TextStrokeColor3 = color
  176.             LoadBtn.BorderColor3 = color
  177.         end)
  178.        
  179.         LoadBtn.MouseButton1Click:Connect(function()
  180.             tween:Create(LoadTitle,TweenInfo.new(0.1),{BackgroundTransparency = 1,TextTransparency = 1,TextStrokeTransparency = 1}):Play()
  181.             tween:Create(LoadInfo,TweenInfo.new(0.1),{TextTransparency = 1,TextStrokeTransparency = 1}):Play()
  182.             tween:Create(LoadBtn,TweenInfo.new(0.1),{BackgroundTransparency = 1,TextTransparency = 1}):Play()
  183.             tween:Create(Zoom,info(0.2),{Size = UDim2.new(0,0,0,0),ImageTransparency = 1}):Play()
  184.             tween:Create(blur,info(0.2),{Size = 0}):Play()
  185.             delay(0.2,function()
  186.                 Load:Destroy()
  187.                 blur:Destroy()
  188.             end)
  189.            
  190.             rs:Disconnect()
  191.             ui:load()
  192.         end)
  193.     end
  194.    
  195.     ui.load = function()
  196.         for i,v in pairs(self.menus) do
  197.             local y = v.yindex
  198.             local sizex = 200
  199.             local sizey = 35
  200.             local gapsize = 5
  201.             local sy = #v.entries * (sizey + gapsize) - gapsize
  202.            
  203.             local frame = Instance.new("Frame",GuiLib)
  204.             frame.Name = v.name
  205.             frame.Position = UDim2.new(0,50 + (i-1) * (sizex + 10),0,80)
  206.             frame.Size = UDim2.new(0,sizex,0,sy)
  207.             frame.BackgroundColor3 = Color3.fromRGB(55,55,55)
  208.             frame.BorderSizePixel = 0
  209.             frame.BackgroundTransparency = 1
  210.             frame.ClipsDescendants = true
  211.            
  212.             local zoom = Instance.new("ImageLabel")
  213.             zoom.Name = "zoom"
  214.             zoom.Parent = frame
  215.             zoom.AnchorPoint = Vector2.new(0.5, 0.5)
  216.             zoom.BackgroundColor3 = Color3.new(1, 1, 1)
  217.             zoom.BackgroundTransparency = 1
  218.             zoom.Position = UDim2.new(0.5, 0, 0.5, 0)
  219.             zoom.Size = UDim2.new(0,0,0,0)
  220.             zoom.Image = "http://www.roblox.com/asset/?id=631172870"
  221.             zoom.ImageColor3 = Color3.new(0.27451, 0.27451, 0.27451)
  222.             zoom.ImageTransparency = 1
  223.             zoom.ZIndex = -1
  224.            
  225.             local title = Instance.new("TextLabel")
  226.             title.Name = "title"
  227.             title.Parent = GuiLib
  228.             title.Size = UDim2.new(0,sizex,0,40)
  229.             title.Position = UDim2.new(0,50 + (i-1) * (sizex + 10),0,80)
  230.             title.BorderSizePixel = 0
  231.             title.BackgroundColor3 = Color3.fromRGB(173, 16, 255)
  232.             title.Text = v.name
  233.             title.TextSize = 25
  234.             title.Font = Enum.Font.SourceSansBold
  235.             title.TextColor3 = Color3.new(1,1,1)
  236.             title.TextTransparency = 1
  237.             title.BackgroundTransparency = 1
  238.             title.ZIndex = -2
  239.            
  240.             self.rainbow[i] = title
  241.            
  242.             tween:Create(zoom,info(0.2),{Size = UDim2.new(0,sy*2,0,sy*2),ImageTransparency = 0}):Play()
  243.            
  244.             wait(0.2)
  245.            
  246.             frame.BackgroundTransparency = 0
  247.             zoom:Destroy()
  248.             --frame.ClipsDescendants = false
  249.             tween:Create(title,info(0.1),{Position = UDim2.new(0,50 + (i-1) * (sizex + 10),0,40),TextTransparency = 0,BackgroundTransparency = 0}):Play()
  250.            
  251.             local shit = {}
  252.            
  253.             for n,data in pairs(v.entries) do
  254.                 if data.class == "btn" then
  255.                     local lab
  256.                     local toggled = false
  257.                    
  258.                     local btn = Instance.new("TextButton")
  259.                     btn.Name = data.name
  260.                     btn.Parent = frame
  261.                     btn.Size = UDim2.new(1,0,0,sizey)
  262.                     btn.Position = UDim2.new(0,0,0,y)
  263.                     btn.BorderSizePixel = 0
  264.                     btn.BackgroundColor3 = Color3.fromRGB(85,85,85)
  265.                     btn.Text = data.text
  266.                     btn.TextSize = 18
  267.                     btn.Font = Enum.Font.SourceSansSemibold
  268.                     btn.TextColor3 = Color3.new(1,1,1)
  269.                     btn.BackgroundTransparency = 1
  270.                     btn.TextTransparency = 1
  271.                    
  272.                     if data.toggle then
  273.                         lab = Instance.new("TextLabel")
  274.                         lab.Name = "tog"
  275.                         lab.Parent = btn
  276.                         lab.AnchorPoint = Vector2.new(1,0)
  277.                         lab.Position = UDim2.new(0.95,0,0,0)
  278.                         lab.Size = UDim2.new(0.1,0,1,0)
  279.                         lab.BackgroundTransparency = 1
  280.                         lab.TextSize = 16
  281.                         lab.Font = Enum.Font.SourceSansSemibold
  282.                         lab.Text = "OFF"
  283.                         lab.TextColor3 = Color3.new(1,0,0)
  284.                         lab.TextTransparency = 1
  285.                        
  286.                         tween:Create(lab,info(0.2),{TextTransparency = 0}):Play()
  287.                        
  288.                         if data.bind then
  289.                             client.binds[data.bind] = false
  290.                         end
  291.                     end
  292.                    
  293.                     tween:Create(btn,info(0.2),{BackgroundTransparency = 0,TextTransparency = 0}):Play()
  294.                    
  295.                     y = y + sizey + gapsize
  296.                    
  297.                     btn.MouseButton1Click:Connect(function()
  298.                         if lab then
  299.                             toggled = not toggled
  300.                             local c = toggled and Color3.new(0,1,0) or Color3.new(1,0,0)
  301.                             local t = toggled and "ON" or "OFF"
  302.                            
  303.                             tween:Create(lab,info(0.35),{TextColor3 = c}):Play()
  304.                             lab.Text = t
  305.                            
  306.                             if data.bind then
  307.                                 client.binds[data.bind] = toggled
  308.                             end
  309.                         end
  310.                        
  311.                         if data.callback then
  312.                             data.callback(btn)
  313.                         end
  314.                     end)
  315.                 elseif data.class == "sdr" then
  316.                     local dragging = false
  317.                     local range = data.max
  318.                     local inc = 1/range
  319.                    
  320.                     local sframe = Instance.new("Frame")
  321.                     sframe.Name = data.name
  322.                     sframe.Parent = frame
  323.                     sframe.Size = UDim2.new(1,0,0,sizey)
  324.                     sframe.Position = UDim2.new(0,0,0,y)
  325.                     sframe.BorderSizePixel = 0
  326.                     sframe.BackgroundColor3 = Color3.fromRGB(85,85,85)
  327.                     sframe.BackgroundTransparency = 1
  328.                     sframe.ClipsDescendants = true
  329.                    
  330.                     local dframe = Instance.new("Frame")
  331.                     dframe.Name = "slider"
  332.                     dframe.Parent = sframe
  333.                     dframe.Size = UDim2.new(inc * data.default,0,1,0)
  334.                     dframe.Position = UDim2.new(0,0,0,0)
  335.                     dframe.BorderSizePixel = 0
  336.                     dframe.BackgroundColor3 = Color3.new(1,1,1)
  337.                     dframe.BackgroundTransparency = 1
  338.                    
  339.                     local label = Instance.new("TextLabel")
  340.                     label.Name = "text"
  341.                     label.Parent = sframe
  342.                     label.Size = UDim2.new(1,0,1,0)
  343.                     label.BackgroundTransparency = 1
  344.                     label.TextSize = 18
  345.                     label.Font = Enum.Font.SourceSansSemibold
  346.                     label.TextTransparency = 1
  347.                     label.Text = data.text .. " | " .. tostring(data.default)
  348.                     label.TextColor3 = Color3.new(1,1,1)
  349.                    
  350.                     self.sliders[data.name] = {max = data.max,frame = dframe,text = data.text,label = label}
  351.                    
  352.                     tween:Create(sframe,info(0.2),{BackgroundTransparency = 0}):Play()
  353.                     tween:Create(dframe,info(0.2),{BackgroundTransparency = 0.8}):Play()
  354.                     tween:Create(label,info(0.2),{TextTransparency = 0}):Play()
  355.                    
  356.                     y = y + sizey + gapsize
  357.                    
  358.                     local function slide(input)
  359.                         local size = UDim2.new(math.clamp((input.Position.X - sframe.AbsolutePosition.X) / sframe.AbsoluteSize.X, 0, 1), 0, 1, 0);
  360.                        
  361.                         tween:Create(dframe,info(0.2,Enum.EasingStyle.Back,Enum.EasingDirection.Out),{Size = size}):Play()
  362.                        
  363.                         local value = math.floor(((size.X.Scale * data.max) / data.max) * (data.max - data.min) + data.min);
  364.                         label.Text = data.text .. " | " .. tostring(value);
  365.                         data.callback(value);
  366.                     end
  367.                    
  368.                     sframe.InputBegan:Connect(function(obj)
  369.                         if obj.UserInputType == Enum.UserInputType.MouseButton1 then
  370.                             dragging = true
  371.                             slide(obj)
  372.                         end
  373.                     end)
  374.                    
  375.                     sframe.InputEnded:Connect(function(obj)
  376.                         if obj.UserInputType == Enum.UserInputType.MouseButton1 then
  377.                             dragging = false
  378.                         end
  379.                     end)
  380.                    
  381.                     userinput.InputChanged:Connect(function(obj)
  382.                         if dragging and obj.UserInputType == Enum.UserInputType.MouseMovement then
  383.                             slide(obj)
  384.                         end
  385.                     end)
  386.                 elseif data.class == "ipt" then
  387.                     local sframe = Instance.new("Frame")
  388.                     sframe.Name = data.name
  389.                     sframe.Parent = frame
  390.                     sframe.Size = UDim2.new(1,0,0,sizey)
  391.                     sframe.Position = UDim2.new(0,0,0,y)
  392.                     sframe.BorderSizePixel = 0
  393.                     sframe.BackgroundColor3 = Color3.fromRGB(85,85,85)
  394.                     sframe.BackgroundTransparency = 1
  395.                     sframe.ClipsDescendants = true
  396.                    
  397.                     local title = Instance.new("TextLabel")
  398.                     title.Name = "title"
  399.                     title.Parent = sframe
  400.                     title.Size = UDim2.new(0.5,0,1,0)
  401.                     title.AnchorPoint = Vector2.new(1,0)
  402.                     title.Position = UDim2.new(0.5,0,0,0)
  403.                     title.BackgroundTransparency = 1
  404.                     title.TextSize = 18
  405.                     title.Font = Enum.Font.SourceSansSemibold
  406.                     title.TextColor3 = Color3.new(1,1,1)
  407.                     title.Text = data.text..": "
  408.                     title.TextXAlignment = Enum.TextXAlignment.Right
  409.                     title.TextTransparency = 1
  410.                    
  411.                     local label = Instance.new("TextBox")
  412.                     label.Name = "input"
  413.                     label.Parent = sframe
  414.                     label.Size = UDim2.new(0.4,0,0.75,0)
  415.                     label.AnchorPoint = Vector2.new(0,0.5)
  416.                     label.Position = UDim2.new(0.55,0,0.5,0)
  417.                     label.BackgroundTransparency = 1
  418.                     label.BackgroundColor3 = Color3.fromRGB(70,70,70)
  419.                     label.BorderSizePixel = 0
  420.                     label.TextSize = 18
  421.                     label.Font = Enum.Font.SourceSansSemibold
  422.                     label.TextColor3 = Color3.new(1,1,1)
  423.                     label.Text = tostring(data.default)
  424.                     label.TextTransparency = 1
  425.                     label.PlaceholderText = tostring(data.default)
  426.                     label.PlaceholderColor3 = Color3.fromRGB(65,65,65)
  427.                     label.ClipsDescendants = true
  428.                    
  429.                     tween:Create(sframe,info(0.2),{BackgroundTransparency = 0}):Play()
  430.                     tween:Create(title,info(0.2),{TextTransparency = 0}):Play()
  431.                     tween:Create(label,info(0.2),{BackgroundTransparency = 0,TextTransparency = 0}):Play()
  432.                    
  433.                     y = y + sizey + gapsize
  434.                    
  435.                     label.Focused:Connect(function()
  436.                         tween:Create(label,info(0.2),{BackgroundColor3 = Color3.fromRGB(80,80,80)}):Play()
  437.                     end)
  438.                    
  439.                     label.FocusLost:Connect(function()
  440.                         tween:Create(label,info(0.2),{BackgroundColor3 = Color3.fromRGB(70,70,70)}):Play()
  441.                         label.PlaceholderText = label.Text
  442.                        
  443.                         data.callback(label.Text)
  444.                     end)
  445.                 end
  446.                 wait(0.05)
  447.                
  448.                 local lastclick = 0
  449.                 local debounce = false
  450.                 local open = true
  451.                 local dragging = false
  452.                 local dragstart
  453.                 local draginput
  454.                 local startpost
  455.                 local startposf
  456.                
  457.                 local function update(obj)
  458.                     local delta = obj.Position - dragstart
  459.                     title.Position = UDim2.new(startpost.X.Scale, startpost.X.Offset + delta.X, startpost.Y.Scale, startpost.Y.Offset + delta.Y)
  460.                     frame.Position = UDim2.new(startposf.X.Scale, startposf.X.Offset + delta.X, startposf.Y.Scale, startposf.Y.Offset + delta.Y)
  461.                 end
  462.                
  463.                 title.InputBegan:Connect(function(obj)
  464.                     if obj.UserInputType == Enum.UserInputType.MouseButton1 then
  465.                         dragging = true
  466.                         dragstart = obj.Position
  467.                         startpost = title.Position
  468.                         startposf = frame.Position
  469.                        
  470.                         if tick() - lastclick < 0.3 and not debounce then
  471.                             tween:Create(frame,info(0.2),{Size = open and UDim2.new(0,sizex,0,0) or UDim2.new(0,sizex,0,sy)}):Play()
  472.                             open = not open
  473.                             debounce = true
  474.                            
  475.                             delay(0.1,function()
  476.                                 debounce = false
  477.                             end)
  478.                         end
  479.                        
  480.                         lastclick = tick()
  481.                     end
  482.                    
  483.                     obj.Changed:Connect(function()
  484.                         if obj.UserInputState == Enum.UserInputState.End then
  485.                             dragging = false
  486.                         end
  487.                     end)
  488.                 end)
  489.                
  490.                 title.InputChanged:Connect(function(obj)
  491.                     if obj.UserInputType == Enum.UserInputType.MouseMovement then
  492.                         draginput = obj
  493.                     end
  494.                 end)
  495.                
  496.                 userinput.InputChanged:Connect(function(obj)
  497.                     if obj == draginput and dragging then
  498.                         update(obj)
  499.                     end
  500.                 end)
  501.             end
  502.         end
  503.     end
  504.    
  505.     ui.addmenu = function(self,name)
  506.         self.menus[#self.menus+1] = {name = name,entries = {},yindex = 0}
  507.         self.index[name] = #self.menus
  508.     end
  509.    
  510.     ui.addbutton = function(self,menu,name,text,toggle,bind,callback)
  511.         local index = self.menus[self.index[menu]]
  512.        
  513.         index.entries[#index.entries+1] = {class = "btn",name = name,text = text,toggle = toggle,bind = bind,callback = callback}
  514.     end
  515.  
  516.     ui.addinput = function(self,menu,name,text,default,callback)
  517.         local index = self.menus[self.index[menu]]
  518.        
  519.         index.entries[#index.entries+1] = {class = "ipt",name = name,text = text,default = default,callback = callback}
  520.     end
  521.  
  522.     ui.addslider = function(self,menu,name,text,min,max,default,callback)
  523.         local index = self.menus[self.index[menu]]
  524.        
  525.         index.entries[#index.entries+1] = {class = "sdr",name = name,text = text,min = min,max = max,default = default,callback = callback}
  526.     end
  527. end
  528.  
  529. do -- lib
  530.     local self = lib
  531.    
  532.     self.environment = {
  533.         get_upvalues = debug.getupvalues or getupvalues or getupvals or false,
  534.         get_upvalue = debug.getupvalue or getupvalue or getupval or false,
  535.         get_metatable = getrawmetatable or debug.getmetatable or false,
  536.         get_stack = debug.getstack or getstack or false,
  537.         get_namecall = getnamecallmethod or false,
  538.         get_reg = getreg or debug.getregistry or false,
  539.         get_gc = getgc or false,
  540.         get_thread_context = (syn and syn.get_thread_identity) or getthreadcontext or getcontext or false,
  541.         set_thread_context = (syn and syn.set_thread_identity) or setthreadcontext or setcontext or false,
  542.         set_namecall = setnamecallmethod or false,
  543.         set_upvalue = debug.setupvalue or setupvalue or setupval or false,
  544.         set_readonly = setreadonly or make_writeable or false,
  545.         is_l_closure = islclosure or (iscclosure and function(closure) return not iscclosure(closure) end) or false,
  546.         is_x_closure = is_synapse_function or is_protosmasher_closure or issentinelclosure or false,
  547.         hook_function = hookfunction or hookfunc or false,
  548.         new_cclosure = newcclosure or false,
  549.         to_clipboard = (syn and syn.write_clipboard) or writeclipboard or toclipboard or setclipboard or false,
  550.         check_caller = checkcaller or false,
  551.     }
  552.    
  553.     self.rainbow = function(self,x)
  554.         return math.acos(math.cos(x*math.pi))/math.pi
  555.     end
  556. end
  557.  
  558. do -- client
  559.     local self = client
  560.    
  561.     self.binds = {}
  562. end
  563.  
  564. ui:addmenu("test menu")
  565. ui:addmenu("test menu2")
  566. ui:addmenu("settings")
  567.  
  568. ui:addbutton("test menu","button","test button")
  569. ui:addbutton("test menu","toggle","test toggle",true,"testbind")
  570. ui:addinput("test menu","input","test input","example",function(value)
  571.     print(value)
  572. end)
  573. ui:addslider("test menu","slider","test slider",1,150,16,function(value)
  574.     if character then
  575.         character.Humanoid.WalkSpeed = value
  576.     end
  577. end)
  578.  
  579. ui:addbutton("test menu2","button","test button")
  580. ui:addbutton("test menu2","toggle","test toggle",true,"testbind")
  581. ui:addinput("test menu2","input","test input","example",function(value)
  582.     print(value)
  583. end)
  584. ui:addslider("test menu2","slider","test slider",1,10000,16,function(value)
  585.     if character then
  586.         character.Humanoid.JumpPower = value
  587.     end
  588. end)
  589.  
  590. ui:addslider("settings","colorminh","min hue",0,360,260,function(value)
  591.     ui.colorminh = value
  592. end)
  593. ui:addslider("settings","colormaxh","max hue",0,360,290,function(value)
  594.     ui.colormaxh = value
  595. end)
  596. ui:addslider("settings","colors","saturation",100,255,190,function(value)
  597.     ui.colors = value
  598. end)
  599. ui:addslider("settings","colorv","value",0,255,255,function(value)
  600.     ui.colorv = value
  601. end)
  602. ui:addslider("settings","animspeed","speed",1,10,3,function(value)
  603.     ui.animspeed = value
  604. end)
  605. ui:addbutton("settings","copy","copy data",false,nil,function(btn)
  606.     local t = {colorminh = ui.colorminh,colormaxh = ui.colormaxh,colors = ui.colors,colorv = ui.colorv,animspeed = ui.animspeed}
  607.     local j = http:JSONEncode(t)
  608.    
  609.     if lib.environment.to_clipboard then
  610.         lib.environment.to_clipboard(j)
  611.     else
  612.         print(j)
  613.         btn.Text = "clipboard not supported"
  614.         wait(0.5)
  615.         btn.Text = "copy data"
  616.     end
  617. end)
  618.  
  619. ui:addinput("settings","data","paste data","",function(value)
  620.     local t = http:JSONDecode(value)
  621.    
  622.     for i,v in pairs(t) do
  623.         ui:updateslider(i,v)
  624.     end
  625. end)
  626.  
  627. wait(1)
  628.  
  629. ui:init("Game Name", "guiname")
  630.  
  631. local speeds = {
  632.     0.25,
  633.     0.5,
  634.     1,
  635.     2,
  636.     3,
  637.     4,
  638.     5,
  639.     6,
  640.     7,
  641.     8
  642. }
  643.  
  644. run.RenderStepped:Connect(function(dt)
  645.     for i,g in pairs(ui.rainbow) do
  646.         local h = (ui.colormaxh+ui.colorminh)/2 + (math.sin(tick() * speeds[ui.animspeed]) * (ui.colormaxh-ui.colorminh)/2)
  647.         local s = ui.colors
  648.         local v = ui.colorv
  649.        
  650.         g.BackgroundColor3 = Color3.fromHSV(h/360,s/255,v/255)
  651.     end
  652. end)
Add Comment
Please, Sign In to add comment