DuyOnline101

api

Jan 2nd, 2023 (edited)
664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.64 KB | None | 0 0
  1. --[[
  2.  __   ___      _____             _____ _____                                                                                    
  3.  \ \ / / |    |  __ \      /\   |  __ \_   _|                                                                                  
  4.   \ V /| |    | |__) |    /  \  | |__) || |                                                                                    
  5.    > < | |    |  ___/    / /\ \ |  ___/ | |                                                                                    
  6.   / . \| |____| |       / ____ \| |    _| |_                                                                                    
  7.  /_/_\_\______|_|      /_/    \_\_|   |_____|__                        _ __                  _       _              _____ _____
  8.  |  __ \                      / _|     | |  / /                       | |\ \                (_)     | |       /\   |  __ \_   _|
  9.  | |__) |____      _____ _ __| |_ _   _| | | | ___  _ __   _ __   ___ | |_| |  ___  ___ _ __ _ _ __ | |_     /  \  | |__) || |  
  10.  |  ___/ _ \ \ /\ / / _ \ '__|  _| | | | | | |/ _ \| '__| | '_ \ / _ \| __| | / __|/ __| '__| | '_ \| __|   / /\ \ |  ___/ | |  
  11.  | |  | (_) \ V  V /  __/ |  | | | |_| | | | | (_) | |    | | | | (_) | |_| | \__ \ (__| |  | | |_) | |_   / ____ \| |    _| |_
  12.  |_|   \___/ \_/\_/ \___|_|  |_|  \__,_|_| | |\___/|_|    |_| |_|\___/ \__| | |___/\___|_|  |_| .__/ \__| /_/    \_\_|   |_____|
  13.                                             \_\                          /_/                  | |                              
  14.                                                                                               |_|                    
  15.                                                                                              
  16.                                                                                              
  17.     You can suggest everything in discord server
  18.     https://discord.gg/9vG8UJXuNf
  19.  
  20.                                                                    
  21. ]]
  22.  
  23. --[[
  24.     Made by:
  25.         weuz_
  26.         davidshavrov
  27.  
  28.     RoseGold Edition (null checks)
  29. ]]
  30.  
  31. local ver = 1
  32.  
  33. local xlp = {
  34.     ["log"] = function(text) -- just print() who tf will use this
  35.         print(text)
  36.     end,
  37.     ["div"] = function(v1, v2) -- divide int :D
  38.         return v1/v2
  39.     end,
  40.     ["humanoidrootpart"] = function()
  41.         return game:GetService("Players").LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
  42.     end,
  43.     ["humanoid"] = function()
  44.         return game:GetService("Players").LocalPlayer.Character:FindFirstChild("Humanoid")
  45.     end,
  46.     ["tween"] = function(time, pos) -- tween to position by (time) + (cframe)
  47.         if game:GetService("Players").LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
  48.             game:GetService("TweenService"):Create(game.Players.LocalPlayer.Character.HumanoidRootPart, TweenInfo.new(time, Enum.EasingStyle.Linear), {CFrame = pos}):Play() task.wait(time)
  49.         end
  50.     end,
  51.     ["walkTo"] = function(v3) -- walk to position (not pathfinding)
  52.         if game:GetService("Players").LocalPlayer.Character:FindFirstChild("Humanoid") then
  53.             game:GetService("Players").LocalPlayer.Character.Humanoid:MoveTo(v3)
  54.         end
  55.     end,
  56.     ["isExist"] = function(obj) -- check for object, if it is exist then returnes true
  57.         if obj ~= nil then
  58.            return true
  59.         end
  60.     end,
  61.     ["notify"] = function(title, description, duration)
  62.         pcall(function()
  63.             game.StarterGui:SetCore("SendNotification", {
  64.                 Title = title;
  65.                 Text = description;
  66.                 Duration = duration;
  67.             })
  68.         end)
  69.     end,
  70.     ["isSynapse"] = function()
  71.         if syn then
  72.             return true
  73.         else
  74.             return false
  75.         end
  76.     end,
  77.     ['isKrnl'] = function()
  78.         if Krnl then
  79.             return true
  80.         else
  81.             return false
  82.         end
  83.     end,
  84.     ['tableVReturn'] = function(table)
  85.         for i,v in pairs(table) do
  86.             print(i,v)
  87.         end
  88.     end,
  89.     ['nickname'] = game.Players.LocalPlayer.Name,
  90.     ['ver'] = ver,
  91.     ['placeid'] = game.PlaceId,
  92.     ['placeversion'] = game.PlaceVersion,
  93.     ['plrico'] = function(userid)
  94.         return "https://www.roblox.com/headshot-thumbnail/image?userId="..userid.."&width=420&height=420&format=png"
  95.     end,
  96.     ['lplrid'] = game.Players.LocalPlayer.UserId,
  97.     ['getsitebody'] = function(link)
  98.         local Response = syn.request({Url = link, Method = "GET"})
  99.         return Response.Body
  100.     end,
  101.     ['killroblox'] = function()
  102.         game:Shutdown()
  103.     end,
  104.     ['rmagnitude'] = function(v1, v2)
  105.         return (v1-v2).magnitude
  106.     end,
  107.     ['varExchange'] = function(v,v2)
  108.         v,v2 = v2,v
  109.         local vartable = {v,v2}
  110.         return vartable
  111.     end,
  112.     ['enabled'] = true,
  113.     ['player'] = game:GetService("Players").LocalPlayer,
  114.     ['camera'] = function()
  115.         return game:GetService("Workspace").Camera
  116.     end,
  117.     ['search'] = {
  118.         ['byName'] = function(a,b)
  119.             for _,v in pairs(a:GetDescendants()) do
  120.                 if v.Name == b then
  121.                     return v
  122.                 end
  123.             end
  124.             warn("Can't find object")
  125.         end,
  126.         ["byMaterial"] = function(a, b, c)
  127.             pcall(function()
  128.                 local size = c
  129.                 if c+1-1 == nil or c < 1 or c == nil then
  130.                     size = 1
  131.                 elseif c == 0 then
  132.                     size = math.huge
  133.                 end
  134.                 for _, v in pairs(a:GetDescendants()) do
  135.                     if v:IsA(b) then
  136.                         local objects = {}
  137.                         table.insert(objects, v)
  138.                         if #objects == size then
  139.                         return objects
  140.                     end
  141.                     end
  142.                 end
  143.                 warn("Can't find object")
  144.             end)
  145.         end
  146.     },
  147.     ['childTable'] = function(path)
  148.         local rtable = {}
  149.         for _,v in pairs(path:GetChildren()) do
  150.             table.insert(rtable, v)
  151.         end
  152.         return rtable
  153.     end,
  154.     ['afunc'] = function(f)
  155.         --[[
  156.             f = function
  157.  
  158.             function functiontest()
  159.                 task.wait(3) -- you can do task.wait(), it will be async
  160.                 print("test")
  161.             end
  162.            
  163.             api.afunc(functiontest)
  164.         ]]
  165.         local wa = coroutine.create(
  166.             function()
  167.                 f()
  168.             end
  169.         )
  170.         coroutine.resume(wa)
  171.     end,
  172.     ['getclosestpart'] = function(path, t)
  173.         local root = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
  174.         if root == nil then return end
  175.         local studs = math.huge
  176.         local part;
  177.         if not t then
  178.             t = "descendants"
  179.         end
  180.         if t == "descendants" then
  181.             for _, obj in ipairs(path:GetDescendants()) do
  182.                 if obj:IsA('BasePart') then
  183.                     local distance = (root.Position - obj.Position).Magnitude
  184.                     if distance < studs then
  185.                         studs = distance
  186.                         part = obj
  187.                     end
  188.                 end
  189.             end
  190.         else
  191.             for _, obj in ipairs(path:GetDescendants()) do
  192.                 if obj:IsA('BasePart') then
  193.                     local distance = (root.Position - obj.Position).Magnitude
  194.                     if distance < studs then
  195.                         studs = distance
  196.                         part = obj
  197.                     end
  198.                 end
  199.             end
  200.         end
  201.         return part
  202.     end,
  203.     ['getsmallestpart'] = function(path, typee, magnitude)
  204.         if not typee then
  205.             typee = "BasePart"
  206.         end
  207.         if typee ~= "BasePart" and typee ~= "MeshPart" then
  208.             typee = "BasePart"
  209.         end
  210.         if not magnitude then
  211.             magnitude = math.huge
  212.         end
  213.         local root = game:GetService("Players").LocalPlayer.Character.HumanoidRootPart
  214.         if root == nil then return end
  215.         local size = Vector3.new(math.huge,math.huge,math.huge)
  216.         local part;
  217.         for _, obj in ipairs(path:GetDescendants()) do
  218.             if obj:IsA(typee) then
  219.                 local objsize = obj.Size
  220.                 if objsize.X < size.X and objsize.Y < size.Y and (obj.Position-root.Position).magnitude < magnitude then
  221.                     size = objsize
  222.                     part = obj
  223.                 end
  224.             end
  225.         end
  226.         return part
  227.     end,
  228.     ['generaterandomstring'] = function(a)
  229.         local let = ('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'):split('')
  230.         local string = ''
  231.         for i = 1, a do
  232.             string = string..let[math.random(1, #let)]
  233.         end
  234.         return string
  235.     end,
  236.     ['request'] = syn and syn.request or http and http.request or http_request or httprequest or request,
  237.     ['pathfindserv'] = game:GetService('PathfindingService'),
  238.     ['toHMS'] = function(t)
  239.         Minutes = (t - t%60)/60
  240.         t = t - Minutes*60
  241.         Hours = (Minutes - Minutes%60)/60
  242.         Minutes = Minutes - Hours*60
  243.         return string.format("%02i", Hours)..":"..string.format("%02i", Minutes)..":"..string.format("%02i", t)
  244.     end,
  245.     ['tablefind'] = function(tt, va)
  246.         for i,v in pairs(tt) do
  247.             if v == va then
  248.                 return i
  249.             end
  250.         end
  251.     end,
  252.     ['suffixstring'] = function(st)
  253.         local suffixes = {"k", "m", "b", "t", "q", "Q", "sx", "sp", "o", "n", "d"}
  254.         for i = #suffixes, 1, -1 do
  255.             local mp = math.pow(10, i * 3)
  256.             if st >= mp then
  257.                 return ("%.1f"):format(st / mp) .. suffixes[i]
  258.             end
  259.         end
  260.         return tostring(st)
  261.     end,
  262.     ['teleport'] = function(cf)
  263.         game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = cf
  264.     end,
  265.     ['findvalue'] = function(Table, Value)
  266.         if type(Table) == "table" then
  267.             for index, value in pairs(Table) do
  268.                 if value == Value then
  269.                     return true
  270.                 end
  271.             end
  272.         else
  273.             return false
  274.         end
  275.         return false
  276.     end,
  277.     ['webhook'] = function(hook, color, title, description)
  278.         pcall(function()
  279.             local OSTime = os.time();
  280.             local Time = os.date('!*t', OSTime);
  281.             local Embed = {
  282.                 color = color;
  283.                 title =  title;
  284.                 description = description;
  285.             };
  286.    
  287.             (syn and syn.request or http_request) {
  288.                 Url = hook;
  289.                 Method = 'POST';
  290.                 Headers = {
  291.                     ['Content-Type'] = 'application/json';
  292.                 };
  293.                 Body = game:GetService'HttpService':JSONEncode( { content = Content; embeds = { Embed } } );
  294.             };
  295.         end)
  296.     end,
  297.     ['returnvalue'] = function(tab, val)
  298.         ok = false
  299.         for i,v in pairs(tab) do
  300.             if string.match(val, v) then
  301.                 ok = v
  302.                 break
  303.             end
  304.         end
  305.         return ok
  306.     end,
  307.     ['pathfind'] = function(target)
  308.         local PathfindingService = game:GetService("PathfindingService")
  309.         local Humanoid = game.Players.LocalPlayer.Character.Humanoid
  310.         local Root = game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
  311.         local path = PathfindingService:CreatePath({
  312.             AgentCanJump = true,
  313.             WaypointSpacing = 1
  314.         })
  315.         path:ComputeAsync(Root.Position, target)
  316.         local waypoints = path:GetWaypoints()
  317.         for i, waypoint in ipairs(waypoints) do
  318.             game:GetService("Players").LocalPlayer.Character.Humanoid:MoveTo(waypoint.Position)
  319.             game:GetService("Players").LocalPlayer.Character.Humanoid.MoveToFinished:wait()
  320.             if waypoint.Action == Enum.PathWaypointAction.Jump then
  321.                 Humanoid.Jump = true
  322.             end
  323.         end
  324.     end,
  325.     ['getcpnew'] = function(path)
  326.         local Closest
  327.         for i,v in next, path:GetChildren() do
  328.             if Closest == nil then
  329.                 Closest = v
  330.             else
  331.                 if (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.Position).magnitude < (Closest.Position - game.Players.LocalPlayer.Character.HumanoidRootPart.Position).magnitude then
  332.                     Closest = v
  333.                 end
  334.             end
  335.         end
  336.         return Closest
  337.     end,
  338.     ['getcpfrompart'] = function(path, part)
  339.         local Closest
  340.         for i,v in next, path:GetChildren() do
  341.             if v:IsA("MeshPart") or v:IsA("Part") then
  342.                 if Closest == nil then
  343.                     Closest = v
  344.                 else
  345.                     if (part.Position - v.Position).magnitude < (Closest.Position - part.Position).magnitude then
  346.                         Closest = v
  347.                     end
  348.                 end
  349.             end
  350.         end
  351.         return Closest
  352.     end,
  353.     ['partwithnamepart'] = function(name, path)
  354.         for i,v in next, path:GetChildren() do
  355.             if (v.Name:match(name)) then
  356.                 return v
  357.             end
  358.         end
  359.     end,
  360.     ['getbiggestmodel'] = function(path)
  361.         local part
  362.         for i,v in next, path:GetChildren() do
  363.             if v:IsA("Model") then
  364.                 if part == nil then
  365.                     part = v
  366.                 end
  367.                 if v:GetExtentsSize().Y > part:GetExtentsSize().Y then
  368.                     part = v
  369.                 end
  370.             end
  371.         end
  372.         return part
  373.     end,
  374.     ['imagehook'] = function(hook, description, title, image, duration)
  375.         pcall(function()
  376.             local OSTime = os.time();
  377.             local Time = os.date('!*t', OSTime);
  378.             local Embed = {
  379.                 color = '3454955';
  380.                 title =  title;
  381.                 description = description;
  382.                 thumbnail = {
  383.                     url = image;
  384.                 };
  385.                 author = {
  386.                     name = game.Players.LocalPlayer.Name;
  387.                 };
  388.             };
  389.    
  390.             (syn and syn.request or http_request) {
  391.                 Url = hook;
  392.                 Method = 'POST';
  393.                 Headers = {
  394.                     ['Content-Type'] = 'application/json';
  395.                 };
  396.                 Body = game:GetService'HttpService':JSONEncode( { content = Content; embeds = { Embed } } );
  397.             };
  398.         end)
  399.     end
  400. }
  401.  
  402. return xlp
Add Comment
Please, Sign In to add comment