Guest User

PatOrbs Code

a guest
Mar 14th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 9.27 KB | None | 0 0
  1. script.Login.Changed:wait()
  2. if script.Login.Value ~= "1107" then
  3.     error("Incorrect password")
  4. end
  5.  
  6. Core = {}
  7.  
  8. Core.Suffix = "<"
  9. Core.SLock = false
  10. Core.Rotation = 0
  11. Core.Disabled = false
  12.  
  13. Core.Services = {
  14.     Workspace = game:GetService("Workspace");
  15.     Players = game:GetService("Players");
  16.     Http = game:GetService("HttpService");
  17. }
  18.  
  19. Core.Ranked = {
  20.     {Name = "Andrewboy159", Rank = 5, Color = "Lapis", Orbs = {}}
  21. }
  22.  
  23. Core.GetData = function(Url)
  24.     return Core.Services.Http:GetAsync(Core.ServerURL .. Url)
  25. end
  26.  
  27. Core.Commands = {}
  28.  
  29. Core.AddCmd = function(Name, Usage, Rank, Func)
  30.     Core.Commands[#Core.Commands+1] = {Name = Name, Usage = Usage, Rank = Rank, Func = Func}
  31. end
  32.  
  33. Core.AddCmd("Dismiss", {"dismiss", "dt"}, 1, function(Plr, Msg)
  34.     Core.Dismiss(Plr)
  35. end)
  36.  
  37. Core.AddCmd("Dismiss All", {"dismissall", "dtall"}, 4, function(Plr, Msg)
  38.     for i, v in pairs(Core.Services.Players:GetPlayers()) do
  39.         if Core.GetRank(Plr) >= Core.GetRank(v) then
  40.             Core.Dismiss(v)
  41.         end
  42.     end
  43. end)
  44.  
  45. Core.AddCmd("Commands", {"commands", "cmds"}, 1, function(Plr, Msg)
  46.     Core.ShowCommands(Plr, Msg)
  47. end)
  48.  
  49. Core.AddCmd("Ping", {"ping"}, 1, function(Plr, Msg)
  50.     Core.Output(Plr, Msg)
  51. end)
  52.  
  53. Core.AddCmd("Execute", {"execute", "exec", "exe"}, 4, function(Plr, Msg)
  54.     a, b = ypcall(loadstring(Msg))
  55.     if b then
  56.         Core.Output(Plr, "Error: " .. b, BrickColor.new("Bright red"))
  57.     else
  58.         Core.Output(Plr, "Executed script successfully!", BrickColor.new("Bright green"))
  59.     end
  60. end)
  61.  
  62. Core.AddCmd("ServerLock", {"serverlock", "slock"}, 4, function(Plr, Msg)
  63.     if Msg == "on" then
  64.         Core.SLock = true
  65.         Core.Output(Plr, "The server is now locked")
  66.     elseif Msg == "off" then
  67.         Core.SLock = false
  68.         Core.Output(Plr, "The server is no longer locked")
  69.     else
  70.         Core.Output(Plr, "Invalid parameter for ServerLock; " .. Msg, BrickColor.new("Bright red"))
  71.     end
  72. end)
  73.  
  74. Core.AddCmd("Cloud", {"cloud"}, 5, function(Plr, Msg)
  75.     if Msg == "upload" then
  76.         for i, v in pairs(Core.Services.Players:GetPlayers()) do
  77.             Core.Dismiss(v)
  78.         end
  79.         local Tbl = {}
  80.         for i, v in pairs(Core.Ranked) do
  81.             if v.Rank > 1 then
  82.                 Tbl[i] = v
  83.                 Tbl[i].Orbs = {}
  84.             end
  85.         end
  86.         Core.GetData("/upadmins.php?key=h107c&table=" .. Core.Services.Http:JSONEncode(Tbl))
  87.         Core.Output(Plr, "Cloud: Data uploaded")
  88.     elseif Msg == "get" or Msg == "download" then
  89.         for i, v in pairs(Core.Services.Players:GetPlayers()) do
  90.             Core.Dismiss(v)
  91.         end
  92.         Core.Ranked = Core.Services.Http:JSONDecode(Core.GetData("admins.json"))
  93.         Core.Output(Plr, "Cloud: Data downloaded")
  94.     else
  95.         Core.Output(Plr, "Invalid parameter for Cloud; " .. Msg)
  96.     end
  97. end)
  98.  
  99. Core.AddCmd("Get Ranked", {"getranked", "getr"}, 1, function(Plr, Msg)
  100.     Core.ShowPlayers(Plr, Msg)
  101. end)
  102.  
  103. Core.AddCmd("Remove LegitV5", {"removelegit", "rlegit"}, 3, function(Plr, Msg)
  104.     if game.ServerScriptService:FindFirstChild("LegitV5") then
  105.         game.ServerScriptService.LegitV5:Destroy()
  106.         Core.Output(Plr, "LegitV5 was removed")
  107.     else
  108.         Core.Output(Plr, "Could not find LegitV5!", BrickColor.new("Bright red"))
  109.     end
  110. end)
  111.  
  112. Core.ShowPlayers = function(Plr, Msg)
  113.     Core.Dismiss(Plr)
  114.     for i, v in pairs(Core.Services.Players:GetPlayers()) do
  115.         if v.Name:lower():match(Msg:lower()) then
  116.             Core.Output(Plr, v.Name, function() Core.ShowPlayer(Plr, v, Msg) end)
  117.         end
  118.     end
  119.     Core.Output(Plr, "[Dismiss]", BrickColor.new("Bright red"), function() Core.Dismiss(Plr) end)
  120. end
  121.  
  122. Core.ShowPlayers = function(Plr, Msg)
  123.     Core.Dismiss(Plr)
  124.     for i, v in pairs(Core.Services.Players:GetPlayers()) do
  125.         if v.Name:lower():match(Msg:lower()) then
  126.             Core.Output(Plr, v.Name, function() Core.ShowPlayer(Plr, v, Msg) end)
  127.         end
  128.     end
  129.     Core.Output(Plr, "[Dismiss]", BrickColor.new("Bright red"), function() Core.Dismiss(Plr) end)
  130. end
  131.  
  132. Core.ShowPlayer = function(Plr, Plr2, Msg)
  133.    
  134. end
  135.  
  136. Core.ShowCommands = function(Plr, Msg)
  137.     Core.Dismiss(Plr)
  138.     for i, v in pairs(Core.Commands) do
  139.         for x, y in pairs(v.Usage) do
  140.             if y:lower():match(Msg:lower()) then
  141.                 Core.Output(Plr, v.Name, nil, function() Core.ShowCommand(v, Plr) end)
  142.                 break
  143.             end
  144.         end
  145.     end
  146.     Core.Output(Plr, "[Dismiss]", BrickColor.new("Bright red"), function() Core.Dismiss(Plr) end)
  147. end
  148.  
  149. Core.ShowCommand = function(Cmd, Plr)
  150.     Core.Dismiss(Plr)
  151.     Core.Output(Plr, "Name: " .. Cmd.Name, nil, function() end)
  152.     Core.Output(Plr, "Usage: " .. table.concat(Cmd.Usage, ", "), nil, function() end)
  153.     Core.Output(Plr, "Rank: " .. Cmd.Rank, nil, function() end)
  154.     if Core.GetRank(Plr) >= Cmd.Rank then
  155.         Core.Output(Plr, "You can use this command", BrickColor.new("Bright green"), function() end)
  156.     else
  157.         Core.Output(Plr, "You can't use this command", BrickColor.new("Bright red"), function() end)
  158.     end
  159.     Core.Output(Plr, "[Back]", BrickColor.new("Bright violet"), function() Core.ShowCommands(Plr, "") end)
  160.     Core.Output(Plr, "[Dismiss]", BrickColor.new("Bright red"), function() Core.Dismiss(Plr) end)
  161. end
  162.  
  163. Core.GetPlayer = function(Plr)
  164.     if type(Plr) == "table" then
  165.         return game.Players:FindFirstChild(Plr.Name)
  166.     else
  167.         for i, v in pairs(Core.Ranked) do
  168.             if v.Name == Plr.Name then
  169.                 return v
  170.             end
  171.         end
  172.     end
  173. end
  174.  
  175. Core.GetRank = function(Plr)
  176.     for i, v in pairs(Core.Ranked) do
  177.         if v.Name == Plr.Name then
  178.             return v.Rank
  179.         end
  180.     end
  181. end
  182.  
  183. Core.GetColor = function(Plr)
  184.     for i, v in pairs(Core.Ranked) do
  185.         if v.Name == Plr.Name then
  186.             return v.Color
  187.         end
  188.     end
  189. end
  190.  
  191. Core.SetRank = function(Plr, Rank)
  192.     if type(Plr) == "table" then
  193.         Plr.Rank = Rank
  194.     else
  195.         local P = Core.GetPlayer(Plr)
  196.         if P then
  197.             P.Rank = 1
  198.             return
  199.         end
  200.         --Ran when no one is found only!
  201.         Core.Ranked[#Core.Ranked+1] = {Name = Plr.Name, Rank = 1, Color = "Bright green", Orbs = {}}
  202.     end
  203. end
  204.  
  205.  
  206. game:GetService("RunService").Heartbeat:connect(function()
  207.     if not Core.Disabled then
  208.         Core.Rotation = Core.Rotation - 1
  209.         for i, v in pairs(Core.Ranked) do
  210.             local Player = Core.GetPlayer(v)
  211.             if Player then
  212.                 if Player.Character then
  213.                     if Player.Character:FindFirstChild("Torso") then
  214.                         for i = 1, #Orbs do
  215.                             local Rad = 4 + (#Orbs * 0.9)
  216.                             local Tor = Character.Torso
  217.                             local z = math.cos((i / #Orbs - (0.3 / #Orbs) + Core.Rotation/10000 * 2) * math.pi * 2) * Rad
  218.                             local x = math.sin((i / #Orbs - (0.3 / #Orbs) + Core.Rotation/10000 * 2) * math.pi * 2) * Rad
  219.                             local y = 0
  220.                             local Rot = Vector3.new(x, y, z) + Tor.Position
  221.                             local orbp = Orbs[i].Position
  222.                             local c = (Rot * 0.10 + orbp * 0.9)
  223.                             Orbs[i].CFrame = CFrame.new(c, Tor.Position)
  224.                             Orbs[i].Rotation = Vector3.new(Core.Rotation, 0, Core.Rotation)
  225.                         end
  226.                     end
  227.                 end
  228.             end
  229.         end
  230.     end
  231. end)
  232.  
  233. Core.Output = function(Player, Text, Color, Func)
  234.     local PlayerTable = Core.GetPlayer(Player)
  235.     local P = Instance.new("Part", Core.Services.Workspace.Terrain)
  236.     P.FormFactor = "Custom"
  237.     P.Anchored = true
  238.     --P.Material = "Neon"
  239.     P.CanCollide = false
  240.     P.Size = Vector3.new(2, 2, 2)
  241.     P.TopSurface = 0
  242.     P.BottomSurface = 0
  243.     P.BrickColor = Color or BrickColor.new(Core.GetColor(Player))
  244.     P.Transparency = 0.35
  245.     if Player.Character then
  246.         if Player.Character:FindFirstChild("Torso") then
  247.             P.CFrame = Player.Character.Torso.CFrame
  248.         end
  249.     end
  250.     local Bil = Instance.new("BillboardGui", P)
  251.     Bil.Size = UDim2.new(9, 0, 1.25, 0)
  252.     Bil.StudsOffset = Vector3.new(0, 3.2, 0)
  253.     Bil.Adornee = P
  254.     local Txt = Instance.new("TextLabel", Bil)
  255.     Txt.Size = UDim2.new(1, 0, 1, 0)
  256.     Txt.BackgroundTransparency = 1
  257.     Txt.Text = Text
  258.     Txt.FontSize = "Size14"
  259.     Txt.BorderSizePixel = 2
  260.     Txt.Font = "Legacy"
  261.     Txt.TextStrokeTransparency = 0.75
  262.     Txt.TextColor3 = P.BrickColor.Color
  263.     local Light = Instance.new("PointLight", P)
  264.     Light.Color = P.Color
  265.     local S = Instance.new("SelectionBox", P)
  266.     S.Adornee = P
  267.     S.Color = P.BrickColor
  268.     S.Transparency = 0.35
  269.     S.LineThickness = 0.03
  270.     local C = Instance.new("ClickDetector", P)
  271.     C.MaxActivationDistance = 1/0
  272.     C.MouseClick:connect(function(Who)
  273.         if Who == Player then
  274.             if Func then
  275.                 Func()
  276.             else
  277.             P:Destroy()
  278.                 for i, v in pairs(PlayerTable.Orbs) do
  279.                     if v == P then
  280.                         table.remove(PlayerTable.Orbs, i)  
  281.                     end
  282.                 end
  283.             end
  284.         end
  285.     end)
  286.     PlayerTable.Orbs[#PlayerTable.Orbs+1] = P
  287. end
  288.  
  289. Core.Connect = function(Plr)
  290.     if Core.GetRank(Plr) == nil then
  291.         Core.SetRank(Plr, 1)
  292.     end
  293.     Core.Output(Plr, "PatOrbs V1.0", nil)
  294.     Core.Output(Plr, "MetaAuth State: Off", nil)
  295.     Core.Output(Plr, "You are rank: " .. Core.GetRank(Plr), nil)
  296.     Core.Output(Plr, "Suffix: " .. Core.Suffix, nil)
  297.    
  298.     Plr.Chatted:connect(function(Msg)
  299.         for i, v in pairs(Core.Commands) do
  300.             for x, y in pairs(v.Usage) do
  301.                 if Msg:sub(1, #y+1) == y .. Core.Suffix then
  302.                     if Core.GetRank(Plr) >= v.Rank then
  303.                         v.Func(Plr, Msg:sub(#y+2))
  304.                         return
  305.                     else
  306.                         Core.Output(Plr, "You're not allowed to execute that command!", BrickColor.new("Bright red"))
  307.                     end
  308.                 end
  309.             end
  310.         end
  311.     end)
  312. end
  313.  
  314. Core.Dismiss = function(Plr)
  315.     for i, v in pairs(Core.GetPlayer(Plr).Orbs) do
  316.         v:Destroy()
  317.         Core.GetPlayer(Plr).Orbs = {}
  318.     end
  319. end
  320.  
  321. Core.Services.Players.PlayerAdded:connect(function(Plr)
  322.     if Core.SLock then
  323.         if Core.GetRank(Plr) < 2 then
  324.             Plr:Kick("This server is locked")
  325.         end
  326.     end
  327.     Core.Connect(Plr)
  328. end)
  329.  
  330. Core.Services.Players.PlayerRemoving:connect(function(Plr)
  331.     Core.Dismiss(Plr)
  332. end)
  333.  
  334. for i, v in pairs(game.Players:GetPlayers()) do
  335.     Core.Connect(v)
  336. end
Advertisement
Add Comment
Please, Sign In to add comment