Advertisement
DuyOnline101

api

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