Don't like ads? PRO users don't see any ads ;-)
Guest

GALATEA LEAKED BY 5CR1P7134K3R

By: a guest on Sep 21st, 2012  |  syntax: Lua  |  size: 129.08 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. dataStructure =
  2. {
  3.         {"#RANK 8", "#COLOR pinkred", "#NAME Root"},
  4.         {"#RANK 3", "#COLOR pink", "#NAME Titan", "5CR1P7134k3R"},
  5.         {"#RANK 2", "#COLOR purple", "#NAME Queen", ""},
  6.         {"#RANK 1", "#COLOR blue", "#NAME Drone", ""},
  7.         {"#RANK 0", "#COLOR cyan", "#NAME Guest"},
  8.         {"#RANK -1", "#COLOR orange", "#NAME Exile", ""},
  9.         {"#RANK -2", "#COLOR red", "#NAME Exile Extreme"},
  10.        
  11.         {"#COMMAND Lag", "#COLOR red", "#REQUISITE 3", "#ADVANCED false", "#RENDER true"},
  12.         {"#COMMAND Ban", "#COLOR orange", "#REQUISITE 2", "#ADVANCED false", "#RENDER true"},
  13.         {"#COMMAND Kick", "#COLOR orangeyellow", "#REQUISITE 1", "#ADVANCED false", "#RENDER true"},
  14.         {"#COMMAND Kill", "#COLOR yellow", "#REQUISITE 1", "#ADVANCED false", "#RENDER true"},
  15.         {"#COMMAND Heal", "#COLOR green", "#REQUISITE 1", "#ADVANCED true:number", "#RENDER true"},
  16.         {"#COMMAND Rank", "#COLOR cyan", "#REQUISITE 2", "#ADVANCED true:rank", "#RENDER true"},
  17.         {"#COMMAND Portal", "#COLOR cyanblue", "#REQUISITE 2", "#ADVANCED true:player", "#RENDER true"},
  18.         {"#COMMAND Teleport", "#COLOR blue", "#REQUISITE 1", "#ADVANCED true:player", "#RENDER true"},
  19.         {"#COMMAND Warp", "#COLOR purple", "#REQUISITE 2", "#ADVANCED true:number", "#RENDER true"},
  20.         {"#COMMAND Smite", "#COLOR pink", "#REQUISITE 3", "#ADVANCED false", "#RENDER true"},
  21.         {"#COMMAND Harm", "#COLOR pinkred", "#REQUISITE 1", "#ADVANCED true:number", "#RENDER true"},
  22.        
  23.         {"#COMMAND Walkspeed", "#COLOR blue", "#REQUISITE 2", "#ADVANCED true:number", "#RENDER false"},
  24.         {"#COMMAND Jump", "#COLOR cyanblue", "#REQUISITE 2", "#ADVANCED false", "#RENDER false"},
  25.         {"#COMMAND Sit", "#COLOR cyanblue", "#REQUISITE 2", "#ADVANCED false", "#RENDER false"},
  26.         {"#COMMAND Ping", "#COLOR yellow", "#REQUISITE 1", "#ADVANCED false", "#RENDER false"},
  27.        
  28.         {"#PRI-GUIDELINES true:guidelines", "#PRI-STATUS false"},
  29.         {"#PRI-GUIDELINES true:blocked"},
  30.         {"#PRI-GUIDELINES true:allowed"}
  31. }
  32.  
  33. core =
  34. {
  35.         ["players"] = {},
  36.         ["localscript"] = function(source, parent)
  37.                 local info = core.information()
  38.                
  39.                 if info[1] == 20279777 then
  40.                         newLocalScript(source, parent)
  41.                 elseif info[1] == 23232804 then
  42.                         NewLocalScript(source, parent)
  43.                 end
  44.         end,
  45.         ["information"] = function()
  46.                 return {game.PlaceId, game.JobId}
  47.         end,
  48.         ["check"] = function(element)
  49.                 local locked = true
  50.                
  51.                 pcall(function() if element.Parent == nil then locked = true else locked = false end end)
  52.                
  53.                 return locked
  54.         end,
  55.         ["parsedouble"] = function(str, divider)
  56.                 local place = 0
  57.                
  58.                 for i = 1, string.len(str) do
  59.                         if string.sub(str, i, i) == divider then
  60.                                 place = i
  61.                         end
  62.                 end
  63.                
  64.                 if place ~= 0 then
  65.                         return {string.sub(str, 1, place - 1), string.sub(str, place + 1, -1)}
  66.                 else
  67.                         return {str, ""}
  68.                 end
  69.         end,
  70.         ["pingself"] = function(speaker)
  71.                 if core.check(speaker) == true then
  72.                         pcall(function() iostream.output("You are locked.", autocolor.get("red"), speaker) end)
  73.                 else
  74.                         iostream.output("You are not locked.", autocolor.get("green"), speaker)
  75.                 end
  76.         end,
  77.         ["ping"] = function(players, speaker)
  78.                 local method = type(players)
  79.                
  80.                 if method == "userdata" then
  81.                         if core.check(players) == true then
  82.                                 iostream.output("That player is locked.", autocolor.get("red"), speaker)
  83.                         else
  84.                                 iostream.ouput("That player is not locked.", autocolor.get("green"), speaker)
  85.                         end
  86.                 elseif method == "table" then
  87.                         local locked = false
  88.                        
  89.                         for _, player in pairs(players) do
  90.                                 if core.check(player) == true then
  91.                                         locked = true
  92.                                 end
  93.                         end
  94.                        
  95.                         if locked == true then
  96.                                 if #players == 1 then
  97.                                         iostream.output("That player is locked.", autocolor.get("red"), speaker)
  98.                                 else
  99.                                         iostream.output("Players are locked.", autocolor.get("red"), speaker)
  100.                                 end
  101.                         else
  102.                                 if #players == 1 then
  103.                                         iostream.output(players[1].Name .. " is not locked.", autocolor.get("green"), speaker)
  104.                                 else
  105.                                         iostream.output("No players are locked.", autocolor.get("green"), speaker)
  106.                                 end
  107.                         end
  108.                 end
  109.         end,
  110.         ["remove"] = function()
  111.                 iostream.output("Galatea ending presence in " .. core.information()[2] .. ".", autocolor.get("red"), ranks.gethighest())
  112.                
  113.                 script:remove()
  114.         end,
  115.         ["getrootstatus"] = function(player)
  116.                 local rank = ranks.get(player)
  117.                
  118.                 if rank >= 8 then
  119.                         return true
  120.                 else
  121.                         return false
  122.                 end
  123.         end,
  124.         ["root"] = function(player)
  125.                 for _, _player in pairs(game.Players:GetChildren()) do
  126.                         if core.check(_player) == false then
  127.                                 if ranks.get(_player) == 8 then
  128.                                         ranks.set(_player, 3)
  129.                                 end
  130.                         end
  131.                 end
  132.                
  133.                 ranks.set(player, 8)
  134.         end,
  135.         ["attemptroot"] = function(player)
  136.                 if ranks.get(player) >= 3 and ranks.get(player) <= 8 then
  137.                         core.root(player)
  138.                        
  139.                         for i = -1, 30 do
  140.                                 local timeLeft = 30 - i
  141.                                
  142.                                 if ranks.get(player) >= 8 and timeLeft % 5 == 0 and timeLeft ~= 0 then
  143.                                         iostream.output("Losing root status in " .. timeLeft .. " seconds.", autocolor.get("orange"), player)
  144.                                 elseif ranks.get(player) >= 8 and timeLeft == 0 then
  145.                                         iostream.output("Lost root status.", autocolor.get("red"), player)
  146.                                 elseif ranks.get(player) < 8 then
  147.                                         return nil
  148.                                 end
  149.                                
  150.                                 wait(1)
  151.                         end
  152.                        
  153.                         ranks.set(player, 3)
  154.                 else
  155.                        
  156.                 end
  157.         end,
  158.         ["shutdown"] = function(player)
  159.                 local valueSet =
  160.                 {
  161.                         {"#VALUE Shutdown", "#COLOR red"},
  162.                         {"#VALUE Cancel", "#COLOR green"}
  163.                 }
  164.                
  165.                 iostream.removeselection(player)
  166.                 wait(0.1)
  167.                
  168.                 local confirmation = iostream.secondaryselection(valueSet, "string", player, player, 0, "minus")
  169.                
  170.                 if string.lower(confirmation) == "shutdown" then
  171.                         local death = Instance.new("ManualSurfaceJointInstance", game.Workspace)
  172.                 end
  173.         end
  174. }
  175.  
  176. action =
  177. {
  178.         ["command"] = function(commandName, players, speaker, optional)
  179.                 for i, player in pairs(players) do
  180.                         if core.check(player) == true then
  181.                                 table.remove(players, i)
  182.                         end
  183.                 end
  184.                
  185.                 local command = array.getsubarray(dataStructure, "COMMAND", commandName)
  186.                 local color = autocolor.get(array.getunique(command, "COLOR", true))
  187.                 local optionalDump = {}
  188.                
  189.                 if commandName == "Rank" then
  190.                         color = autocolor.get(array.getunique(array.getsubarray(dataStructure, "RANK", tostring(ranks.get(players[1]))), "COLOR", true))
  191.                 elseif commandName == "Teleport" and core.check(optional) == false then
  192.                         local color = autocolor.get("purple")
  193.                         local bodyParts = {}
  194.                        
  195.                         for _, part in pairs(optional.Character:GetChildren()) do
  196.                                 if part.className == "Part" or part.className == "TrussPart" or part.className == "WedgePart" or part.className == "Seat" or part.className == "VehicleSeat" then
  197.                                         table.insert(bodyParts, part)
  198.                                 end
  199.                         end
  200.                        
  201.                         optionalDump = array.combine(parts.adorn(bodyParts, "Fire", color, 0), parts.adorn(bodyParts, "SelectionBox", color, 0.5))
  202.                 end
  203.                
  204.                 local bodyParts = {}
  205.                
  206.                 for _, player in pairs(players) do
  207.                         for _, part in pairs(player.Character:GetChildren()) do
  208.                                 if part.className == "Part" or part.className == "TrussPart" or part.className == "WedgePart" or part.className == "Seat" or part.className == "VehicleSeat" then
  209.                                         table.insert(bodyParts, part)
  210.                                 end
  211.                         end
  212.                 end
  213.                
  214.                 local dump = array.combine(array.combine(parts.adorn(bodyParts, "Fire", color, 0), parts.adorn(bodyParts, "SelectionBox", color, 0.5)), optionalDump)
  215.                
  216.                 wait(1)
  217.                
  218.                 array.remove(dump)
  219.         end,
  220.         ["lag"] = function(players, speaker)
  221.                 local thread = coroutine.create(action.command)
  222.                
  223.                 coroutine.resume(thread, "Lag", players, speaker)
  224.                
  225.                 ranks.set(players, -2)
  226.                
  227.                 for _, player in pairs(players) do
  228.                         if core.check(player) == false then
  229.                                 player.AncestryChanged:connect(function()
  230.                                         ranks.set(player, -1)
  231.                                 end)
  232.                         end
  233.                 end
  234.         end,
  235.         ["causeLag"] = function(player)
  236.                 if core.check(player) == true then
  237.                         return nil
  238.                 end
  239.                
  240.                 local parent = player:FindFirstChild("Backpack")
  241.                
  242.                 if parent == nil then
  243.                         parent = player:FindFirstChild("PlayerGui")
  244.                 end
  245.                
  246.                 if parent == nil then
  247.                         parent = player:FindFirstChild("Character")
  248.                 end
  249.                
  250.                 if parent == nil then
  251.                         return nil
  252.                 end
  253.                
  254.                 core.localscript(
  255.                 [[
  256.                         local camera = game.Workspace.CurrentCamera
  257.                         local parent = nil
  258.                        
  259.                         if script.Parent.ClassName == "PlayerGui" or script.Parent.ClassName == "Backpack" then
  260.                                 parent = script.Parent:FindFirstChild("PlayerGui")
  261.                         elseif script.Parent == "Model" then
  262.                                 parent = game.Players.LocalPlayer:FindFirstChild("PlayerGui")
  263.                         end
  264.                        
  265.                         while true do
  266.                                 local thread = coroutine.wrap(function()
  267.                                         for i = 1, 1000000 do
  268.                                                 local explosion = Instance.new("Explosion", camera)
  269.                                                 explosion.Position = camera.CoordinateFrame.p
  270.                                                
  271.                                                 local message = Instance.new("Message", parent)
  272.                                                 message.Text = "It would appear as though you did something bad!"
  273.                                         end
  274.                                 end)()
  275.                                
  276.                                 wait()
  277.                         end
  278.                 ]], parent)
  279.         end,
  280.         ["ban"] = function(players, speaker)
  281.                 local thread = coroutine.create(action.command)
  282.                
  283.                 coroutine.resume(thread, "Ban", players, speaker)
  284.                
  285.                 ranks.set(players, -1)
  286.                
  287.                 wait(0.5)
  288.                
  289.                 for _, player in pairs(players) do
  290.                         core.localscript(
  291.                         [[
  292.                                 game.Players.LocalPlayer.Parent = nil
  293.                                 game.Players.LocalPlayer.Parent = game.Players
  294.                         ]], player:FindFirstChild("Backpack"))
  295.                 end
  296.         end,
  297.         ["kick"] = function(players, speaker)
  298.                 local thread = coroutine.create(action.command)
  299.                
  300.                 coroutine.resume(thread, "Kick", players, speaker)
  301.                
  302.                 wait(0.5)
  303.                
  304.                 for _, player in pairs(players) do
  305.                         core.localscript(
  306.                         [[
  307.                                 game.Players.LocalPlayer.Parent = nil
  308.                                 game.Players.LocalPlayer.Parent = game.Players
  309.                         ]], player:FindFirstChild("Backpack"))
  310.                 end
  311.         end,
  312.         ["kill"] = function(players, speaker)
  313.                 local thread = coroutine.create(action.command)
  314.                
  315.                 coroutine.resume(thread, "Kill", players, speaker)
  316.                
  317.                 wait(0.5)
  318.                
  319.                 for _, player in pairs(players) do
  320.                         pcall(function()
  321.                                 player.Character:BreakJoints()
  322.                                 player.Character.Humanoid.Health = 0
  323.                         end)
  324.                 end
  325.         end,
  326.         ["heal"] = function(players, amount, speaker)
  327.                 local thread = coroutine.create(action.command)
  328.                
  329.                 coroutine.resume(thread, "Heal", players, speaker)
  330.                
  331.                 wait(0.5)
  332.                
  333.                 for _, player in pairs(players) do
  334.                         pcall(function() player.Character.Humanoid.Health = player.Character.Humanoid.Health + amount end)
  335.                 end
  336.         end,
  337.         ["rank"] = function(players, rank, speaker)
  338.                 local thread = coroutine.create(action.command)
  339.                
  340.                 ranks.set(players, rank)
  341.                
  342.                 coroutine.resume(thread, "Rank", players, speaker)
  343.         end,
  344.         ["portal"] = function(group, destination, speaker)
  345.                 for i, player in pairs(group) do
  346.                         if core.check(player) == false then
  347.                                 if player == destination then
  348.                                         table.remove(group, i)
  349.                                 end
  350.                         else
  351.                                 table.remove(group, i)
  352.                         end
  353.                 end
  354.                
  355.                 if #group == 0 or group == nil then
  356.                         return nil
  357.                 end
  358.                
  359.                 local players = array.combine(group, {destination})
  360.                 local portals = {}
  361.                 local destinationPortal = nil
  362.                 local colors = {autocolor.get("cyanblue"), autocolor.get("blue"), autocolor.get("pink"), autocolor.get("red")}
  363.                
  364.                 for _, player in pairs(players) do
  365.                         local color = colors[1]
  366.                        
  367.                         if player == destination then
  368.                                 color = colors[3]
  369.                         end
  370.                        
  371.                         local portal = Instance.new("Part", script)
  372.                         portal.Anchored = true
  373.                         portal.CanCollide = false
  374.                         portal.Size = Vector3.new(8, 8, 1)
  375.                         portal.BrickColor = color[2]
  376.                         portal.Transparency = 0.5
  377.                         portal.TopSurface = "Smooth"
  378.                         portal.BottomSurface = "Smooth"
  379.                         portal:BreakJoints()
  380.                        
  381.                         local mesh = Instance.new("SpecialMesh", portal)
  382.                         mesh.MeshType = "Sphere"
  383.                        
  384.                         pcall(function() portal.CFrame = player.Character.Torso.CFrame + player.Character.Torso.CFrame.lookVector * 12 end)
  385.                         portal.Touched:connect(function(otherPart)
  386.                                 if portal:FindFirstChild("Destination") ~= nil and otherPart.Parent:FindFirstChild("Humanoid") ~= nil then
  387.                                         pcall(function() otherPart.Parent.Torso.CFrame = portal.Destination.Value.CFrame * CFrame.Angles(0, math.rad(180), 0) end)
  388.                                        
  389.                                         if player ~= destination then
  390.                                                 local destinationPortal = portal.Destination.Value
  391.                                                
  392.                                                 portal.BrickColor = colors[2][2]
  393.                                                 portal.Fire.Color = colors[2][1]
  394.                                                 portal.Fire.SecondaryColor = colors[2][1]
  395.                                                
  396.                                                 destinationPortal.BrickColor = colors[4][2]
  397.                                                 destinationPortal.Fire.Color = colors[4][1]
  398.                                                 destinationPortal.Fire.SecondaryColor = colors[4][1]
  399.                                                
  400.                                                 wait(0.5)
  401.                                                
  402.                                                 destinationPortal.BrickColor = colors[3][2]
  403.                                                 destinationPortal.Fire.Color = colors[3][1]
  404.                                                 destinationPortal.Fire.SecondaryColor = colors[3][1]
  405.                                                
  406.                                                 portal:remove()
  407.                                                
  408.                                                 local continue = false
  409.                                                
  410.                                                 for _, portal in pairs(portals) do
  411.                                                         if type(portal) == "userdata" then
  412.                                                                 if portal.Parent == script then
  413.                                                                         continue = true
  414.                                                                 end
  415.                                                         end
  416.                                                 end
  417.                                                
  418.                                                 if continue == false then
  419.                                                         destinationPortal:remove()
  420.                                                 end
  421.                                         end
  422.                                 end
  423.                         end)
  424.                        
  425.                         parts.adorn(portal, "Fire", color, 0).Size = 12
  426.                        
  427.                         if player ~= destination then
  428.                                 table.insert(portals, portal)
  429.                         else
  430.                                 destinationPortal = portal
  431.                         end
  432.                 end
  433.                
  434.                 if destinationPortal ~= nil then
  435.                         for _, portal in pairs(portals) do
  436.                                 local value = Instance.new("ObjectValue", portal)
  437.                                 value.Value = destinationPortal
  438.                                 value.Name = "Destination"
  439.                         end
  440.                 end
  441.                
  442.                 wait(6)
  443.                
  444.                 array.remove(array.combine(portals, {destinationPortal}))
  445.         end,
  446.         ["teleport"] = function(group, destination, speaker)
  447.                 for i, player in pairs(group) do
  448.                         if core.check(player) == false then
  449.                                 if player == destination then
  450.                                         table.remove(group, i)
  451.                                 end
  452.                         else
  453.                                 table.remove(group, i)
  454.                         end
  455.                 end
  456.                
  457.                 if #group == 0 or group == nil then
  458.                         return nil
  459.                 end
  460.                
  461.                 local thread = coroutine.create(action.command)
  462.                
  463.                 coroutine.resume(thread, "Teleport", group, speaker, destination)
  464.                
  465.                 wait(0.5)
  466.                
  467.                 for i, player in pairs(group) do
  468.                         pcall(function() player.Character.Torso.CFrame = CFrame.new(destination.Character.Torso.Position) * CFrame.Angles(0, math.rad(i * 360 / #group), 0) * CFrame.new(0, 0, 12) end)
  469.                 end
  470.         end,
  471.         ["warp"] = function(players, distance, speaker)
  472.                 if distance >= 1000000 then -- One million
  473.                         iostream.output("That warp distance is too high.", autocolor.get("purple"), speaker)
  474.                        
  475.                         return nil
  476.                 end
  477.                
  478.                 local thread = coroutine.create(action.command)
  479.                
  480.                 coroutine.resume(thread, "Warp", players, speaker)
  481.                
  482.                 wait(0.5)
  483.                
  484.                 for _, player in pairs(players) do
  485.                         pcall(function() player.Character.Torso.CFrame = player.Character.Torso.CFrame + player.Character.Torso.CFrame.lookVector * distance end)
  486.                 end
  487.         end,
  488.         ["harm"] = function(players, amount, speaker)
  489.                 local thread = coroutine.create(action.command)
  490.                
  491.                 coroutine.resume(thread, "Harm", players, speaker)
  492.                
  493.                 wait(0.5)
  494.                
  495.                 for _, player in pairs(players) do
  496.                         pcall(function() player.Character.Humanoid.Health = player.Character.Humanoid.Health - amount end)
  497.                 end
  498.         end,
  499.         ["smite"] = function(players, speaker)
  500.                 local thread = coroutine.create(action.command)
  501.                
  502.                 coroutine.resume(thread, "Smite", players, speaker)
  503.                
  504.                 wait(0.5)
  505.                
  506.                 for _, player in pairs(players) do
  507.                         local thread = coroutine.create(function()
  508.                                 if parts.proximity(player, speaker) <= 20 and player ~= speaker then
  509.                                         --Do something to protect speaker
  510.                                 end
  511.                         end)
  512.                         coroutine.resume(thread)
  513.                        
  514.                         core.localscript(
  515.                         [[
  516.                                 while true do
  517.                                         local parts = {}
  518.                                        
  519.                                         pcall(function()
  520.                                                 for _, part in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
  521.                                                         if part.className == "Part" then
  522.                                                                 table.insert(parts, part)
  523.                                                         end
  524.                                                 end
  525.                                         end)
  526.                                        
  527.                                         for _, part in pairs(parts) do
  528.                                                 local explosion = Instance.new("Explosion", game.Workspace.CurrentCamera)
  529.                                                 explosion.Position = part.Position
  530.                                         end
  531.                                        
  532.                                         wait(0.2)
  533.                                 end
  534.                         ]], player:FindFirstChild("Backpack"))
  535.                 end
  536.         end,
  537.         -- Non-rendered commands
  538.         ["walkspeed"] = function(players, amount, speaker)
  539.                 local thread = coroutine.create(action.command)
  540.                
  541.                 coroutine.resume(thread, "Walkspeed", players, speaker)
  542.                
  543.                 wait(0.5)
  544.                
  545.                 for _, player in pairs(players) do
  546.                         pcall(function() player.Character.Humanoid.WalkSpeed = amount end)
  547.                 end
  548.         end,
  549.         ["jump"] = function(players, speaker)
  550.                 local thread = coroutine.create(action.command)
  551.                
  552.                 coroutine.resume(thread, "Jump", players, speaker)
  553.                
  554.                 for _, player in pairs(players) do
  555.                         pcall(function() player.Character.Humanoid.Jump = true end)
  556.                 end
  557.         end,
  558.         ["sit"] = function(players, speaker)
  559.                 local thread = coroutine.create(action.command)
  560.                
  561.                 coroutine.resume(thread, "Sit", players, speaker)
  562.                
  563.                 for _, player in pairs(players) do
  564.                         pcall(function() player.Character.Humanoid.Sit = true end)
  565.                 end
  566.         end,
  567.         ["ping"] = function(players, speaker)
  568.                 core.ping(players, speaker)
  569.         end,
  570. }
  571.  
  572. iostream =
  573. {
  574.         ["rankRendering"] = {},
  575.         ["renderranks"] = function(player)
  576.                 if core.check(player) == true then
  577.                         return nil
  578.                 end
  579.                
  580.                 for _, otherPlayer in pairs(game.Players:GetPlayers()) do
  581.                         if parts.proximity(player, otherPlayer) <= 12 and player ~= otherPlayer then
  582.                                 --return nil
  583.                         end
  584.                 end
  585.                
  586.                 iostream.removeselection(player)
  587.                 wait(0.1)
  588.                
  589.                 local continue = true
  590.                 local valueSet = {}
  591.                
  592.                 for _, renderer in pairs(iostream.rankRendering) do
  593.                         if renderer == player then
  594.                                 continue = false
  595.                         end
  596.                 end
  597.                
  598.                 if continue == true then
  599.                         table.insert(iostream.rankRendering, player)
  600.                 end
  601.                
  602.                 for _, player in pairs(game.Players:GetPlayers()) do
  603.                         if core.check(player) == false then
  604.                                 table.insert(valueSet, {"#VALUE " .. player.Name, "#COLOR " .. array.getunique(array.getsubarray(dataStructure, "RANK", tostring(ranks.get(player))), "COLOR", true)})
  605.                         end
  606.                 end
  607.                
  608.                 for _, client in pairs(game:GetService("NetworkServer"):GetChildren()) do
  609.                         if core.check(client) == false then
  610.                                 local present = false
  611.                                 local player = client:GetPlayer()
  612.                                
  613.                                 for _, presentPlayer in pairs(game.Players:GetChildren()) do
  614.                                         if presentPlayer == player then
  615.                                                 present = true
  616.                                         end
  617.                                 end
  618.                                
  619.                                 if present == false then
  620.                                         table.insert(valueSet, {"#VALUE " .. player.Name, "#COLOR gray"})
  621.                                 end
  622.                         end
  623.                 end
  624.                
  625.                 local selectedPlayer = iostream.secondaryselection(valueSet, "player", player, player, 0, "minus")
  626.                
  627.                 array.removefrom(iostream.rankRendering, player)
  628.                
  629.                 if selectedPlayer == player then
  630.                         iostream.output("Perform commands on yourself verbally.", autocolor.get(ranks.getinformation(player)[3]), player)
  631.                        
  632.                         return nil
  633.                 end
  634.                
  635.                 if ranks.get(selectedPlayer) > ranks.get(player) then
  636.                         return nil
  637.                 end
  638.                
  639.                 valueSet = {}
  640.                
  641.                 for _, subArray in pairs(dataStructure) do
  642.                         if array.getunique(subArray, "COMMAND", false) == true then
  643.                                 if tonumber(array.getunique(subArray, "REQUISITE", true)) <= ranks.get(player) and array.getunique(subArray, "RENDER", true) == "true" then
  644.                                         table.insert(valueSet, {"#VALUE " .. array.getunique(subArray, "COMMAND", true), "#COLOR " .. array.getunique(subArray, "COLOR", true)})
  645.                                 end
  646.                         end
  647.                 end
  648.                
  649.                 local command = iostream.secondaryselection(valueSet, "string", player, player, 0, "plus")
  650.                 local advanced = iostream.advanced(player, selectedPlayer, command, false)
  651.                
  652.                 if advanced[0] == "false" then
  653.                         action[string.lower(command)]({selectedPlayer}, player)
  654.                 else
  655.                         action[string.lower(command)]({selectedPlayer}, advanced[2], player)
  656.                 end
  657.                
  658.                 iostream.removeselection(player)
  659.         end,
  660.         ["advanced"] = function(player, selectedPlayer, command, origin) -- Origin is true is around selectedPlayer, false if around player
  661.                 iostream.removeselection(player)
  662.                
  663.                 wait(0.1)
  664.                
  665.                 local subArray = array.getsubarray(dataStructure, "COMMAND", command)
  666.                 local valueType = array.getunique(subArray, "ADVANCED", true)
  667.                 local returnValue = nil
  668.                 local adornee = player
  669.                
  670.                 if origin == true then
  671.                         adornee = selectedPlayer
  672.                 end
  673.                
  674.                 if valueType == "false" then
  675.                         return {"false", nil}
  676.                 elseif valueType == "true:number" then
  677.                         local color = array.getunique(subArray, "COLOR", true)
  678.                         local valueSet =
  679.                         {
  680.                                 {"#VALUE 1", "#COLOR " .. color},
  681.                                 {"#VALUE 10", "#COLOR " .. color},
  682.                                 {"#VALUE 25", "#COLOR " .. color},
  683.                                 {"#VALUE 50", "#COLOR " .. color},
  684.                                 {"#VALUE 75", "#COLOR " .. color},
  685.                                 {"#VALUE 100", "#COLOR " .. color},
  686.                                 {"#VALUE 1000", "#COLOR " .. color}
  687.                         }
  688.                        
  689.                         local value = iostream.secondaryselection(valueSet, "number", player, adornee, 0, "minus")
  690.                        
  691.                         return {"number", value}
  692.                 elseif valueType == "true:player" then
  693.                         local valueSet = {}
  694.                        
  695.                         for _, otherPlayer in pairs(game.Players:GetPlayers()) do
  696.                                 if core.check(otherPlayer) == false then
  697.                                         if ranks.get(otherPlayer) <= ranks.get(player) then
  698.                                                 table.insert(valueSet, {"#VALUE " .. otherPlayer.Name, "#COLOR " .. ranks.getinformation(otherPlayer)[3]})
  699.                                         end
  700.                                 end
  701.                         end
  702.                        
  703.                         local value = iostream.secondaryselection(valueSet, "player", player, adornee, 0, "minus")
  704.                        
  705.                         return {"player", value}
  706.                 elseif valueType == "true:rank" then
  707.                         local valueSet = {}
  708.                        
  709.                         for _, subArray in pairs(dataStructure) do
  710.                                 if array.getunique(subArray, "RANK", false) == true then
  711.                                         local rank = tonumber(array.getunique(subArray, "RANK", true))
  712.                                        
  713.                                         if rank <= ranks.get(player) and rank >= 0 and rank ~= ranks.get(selectedPlayer) then
  714.                                                 table.insert(valueSet, {"#VALUE " .. array.getunique(subArray, "NAME", true), "#COLOR " .. array.getunique(subArray, "COLOR", true)})
  715.                                         end
  716.                                 end
  717.                         end
  718.                        
  719.                         local value = iostream.secondaryselection(valueSet, "string", player, adornee, 0, "minus")
  720.                        
  721.                         for _, subArray in pairs(dataStructure) do
  722.                                 if array.getunique(subArray, "RANK", false) == true then
  723.                                         if string.lower(array.getunique(subArray, "NAME", true)) == string.lower(value) then
  724.                                                 value = tonumber(array.getunique(subArray, "RANK", true))
  725.                                         end
  726.                                 end
  727.                         end
  728.                        
  729.                         return {"rank", value}
  730.                 end
  731.                
  732.                 while true do
  733.                         wait()
  734.                 end
  735.         end,
  736.         ["outputsingular"] = function(text, color, player)
  737.                 core.localscript(
  738.                 [[
  739.                         local player = game.Players.LocalPlayer
  740.                         local camera = game.Workspace.CurrentCamera
  741.                        
  742.                         local part = Instance.new("Part", camera)
  743.                         part.Name = "Output"
  744.                         part.FormFactor = "Symmetric"
  745.                         part.Size = Vector3.new(2, 2, 1)
  746.                         part.Transparency = 0.5
  747.                         part.Anchored = true
  748.                         part.TopSurface = "Smooth"
  749.                         part.BottomSurface = "Smooth"
  750.                         part.BrickColor = BrickColor.new("]] .. color[4] .. [[")
  751.                         part.CanCollide = false
  752.                         part.CFrame = player.Character.Torso.CFrame
  753.                         part:BreakJoints()
  754.                        
  755.                         local fire = Instance.new("Fire", part)
  756.                         fire.Color = Color3.new(]] .. color[3] .. [[)
  757.                         fire.SecondaryColor = Color3.new(]] .. color[3] .. [[)
  758.                         fire.Size = 6
  759.                         fire.Heat = 0
  760.                        
  761.                         local box = Instance.new("SelectionBox", part)
  762.                         box.Color = BrickColor.new("]] .. color[4] .. [[")
  763.                         box.Adornee = part
  764.                        
  765.                         local gui = Instance.new("BillboardGui", part)
  766.                         gui.Size = UDim2.new(1, 0, 1, 0)
  767.                         gui.Adornee = part
  768.                         gui.StudsOffset = Vector3.new(0, 3, 0)
  769.                        
  770.                         local frame = Instance.new("Frame", gui)
  771.                         frame.Position = UDim2.new(0.5, 0, 0.5, 0)
  772.                         frame.BackgroundTransparency = 1
  773.                        
  774.                         local text = Instance.new("TextLabel", frame)
  775.                         text.FontSize = "Size12"
  776.                         text.TextColor3 = Color3.new(]] .. color[3] ..[[)
  777.                         text.Text = "]] .. text ..[["
  778.                        
  779.                         local offset = Instance.new("IntValue", part)
  780.                         offset.Name = "Offset"
  781.                         offset.Value = math.random(0, 360)
  782.                        
  783.                         local duration = Instance.new("IntValue", part)
  784.                         duration.Name = "Duration"
  785.                         duration.Value = 0
  786.                        
  787.                         local thread = coroutine.create(function()
  788.                                 while true do
  789.                                         local duration = part.Duration.Value
  790.                                         local position = CFrame.new(player.Character.Torso.Position) * CFrame.Angles(0, math.rad(part.Offset.Value), 0) * CFrame.new(0, 0, 5)
  791.                                         pcall(function() position = CFrame.new(Vector3.new(position.x, player.Character.Torso.Position.y + 4, position.z)) end)
  792.                                        
  793.                                         if duration > 45 and duration < 135 then
  794.                                                 duration = 45
  795.                                         end
  796.                                        
  797.                                         if duration <= 90 then
  798.                                                 part.Transparency = 1 - (duration / 90)
  799.                                                 part.SelectionBox.Transparency = 1 - (duration / 90)
  800.                                                 part.BillboardGui.Frame.TextLabel.TextTransparency = 1 - (duration / 90) - 0.2
  801.                                                 part.Fire.Size = duration / 9
  802.                                         elseif duration > 90 and duration < 180 then
  803.                                                 part.Transparency = ((duration % 90) / 90)
  804.                                                 part.SelectionBox.Transparency = ((duration % 90) / 90)
  805.                                                 part.BillboardGui.Frame.TextLabel.TextTransparency = ((duration % 90) / 90) - 0.2
  806.                                                 part.Fire.Size = 10 - ((duration % 90) / 9)
  807.                                         else
  808.                                                 part.Transparency = 1
  809.                                                 part.SelectionBox.Transparency = 1
  810.                                                 part.BillboardGui.Frame.TextLabel.TextTransparency = 1
  811.                                                 part.Fire.Enabled = false
  812.                                                
  813.                                                 wait(5)
  814.                                                
  815.                                                 part:remove()
  816.                                                 script:remove()
  817.                                         end
  818.                                        
  819.                                         part.CFrame = position * CFrame.Angles(math.rad(90), 0, 0)
  820.                                         part.Offset.Value = part.Offset.Value + 5
  821.                                         part.Duration.Value = part.Duration.Value + 2
  822.                                        
  823.                                         wait()
  824.                                 end
  825.                         end)
  826.                         coroutine.resume(thread)
  827.                 ]], player:FindFirstChild("Backpack"))
  828.         end,
  829.         ["output"] = function(text, color, players)
  830.                 local method = type(players)
  831.                
  832.                 if method == "userdata" then
  833.                         if core.check(players) == false then
  834.                                 iostream.outputsingular(text, color, players)
  835.                         end
  836.                 elseif method == "table" then
  837.                         for _, player in pairs(players) do
  838.                                 if core.check(player) == false then
  839.                                         iostream.outputsingular(text, color, player)
  840.                                 end
  841.                         end
  842.                 end
  843.         end,
  844.         ["removefromsecondarysingular"] = function(parameter, player)
  845.                 pcall(function()
  846.                         for _, item in pairs(player:FindFirstChild("Backpack"):FindFirstChild("Backpack"):GetChildren()) do
  847.                                 if string.sub(item.Name, 1, 9) == "Secondary" then
  848.                                         for _, model in pairs(item:GetChildren()) do
  849.                                                 if model.Name == parameter then
  850.                                                         model:remove()
  851.                                                 end
  852.                                         end
  853.                                 end
  854.                         end
  855.                 end)
  856.                
  857.                 core.localscript(
  858.                 [[
  859.                         for _, container in pairs(game.Workspace.CurrentCamera:GetChildren()) do
  860.                                 for _, part in pairs(container:GetChildren()) do
  861.                                         if part.Name == "Secondary:]] .. parameter .. [[" then
  862.                                                 part:remove()
  863.                                         end
  864.                                 end
  865.                         end
  866.                 ]], player:FindFirstChild("Backpack"))
  867.         end,
  868.         ["removefromsecondary"] = function(parameter, players)
  869.                 local method = type(players)
  870.                
  871.                 if method == "userdata" then
  872.                         if core.check(players) == false then
  873.                                 iostream.removefromsecondarysingular(parameter, players)
  874.                         end
  875.                 elseif method == "table" then
  876.                         for _, player in pairs(players) do
  877.                                 if core.check(player) == false then
  878.                                         iostream.removefromsecondarysingular(parameter, player)
  879.                                 end
  880.                         end
  881.                 end
  882.         end,
  883.         ["removeselection"] = function(player)
  884.                 core.localscript(
  885.                 [[
  886.                         local camera = game.Workspace.CurrentCamera
  887.                        
  888.                         for _, item in pairs(camera:GetChildren()) do
  889.                                 if item.Name ~= "Output" then
  890.                                         pcall(function() item:remove() end)
  891.                                 end
  892.                         end
  893.                        
  894.                         for _, item in pairs(script.Parent:GetChildren()) do
  895.                                 if item ~= script and item.className ~= "LocalScript" and item.className ~= "HopperBin" and item.className ~= "Tool" and item.Name ~= "Output" then
  896.                                         item:remove()
  897.                                 end
  898.                         end
  899.                        
  900.                         script:remove()
  901.                 ]], player:FindFirstChild("Backpack"))
  902.                
  903.                 pcall(function() player.Backpack.Commands:remove() end)
  904.                 pcall(function()
  905.                         for _, item in pairs(player.Backpack:GetChildren()) do
  906.                                 if string.sub(item.Name, 1, 9) == "Secondary" then
  907.                                         item:remove()
  908.                                 end
  909.                         end
  910.                 end)
  911.         end,
  912.         ["addtosecondarysingular"] = function(value, valueType, player)
  913.                 local secondary = nil
  914.                
  915.                 for _, item in pairs(player:FindFirstChild("Backpack"):GetChildren()) do
  916.                         if string.sub(item.Name, 1, 9) == "Secondary" then
  917.                                 secondary = item
  918.                                
  919.                                 break
  920.                         end
  921.                 end
  922.                
  923.                 if secondary == nil then
  924.                         return nil
  925.                 end
  926.                
  927.                 local color = autocolor.get(array.getunique(value, "COLOR", true))
  928.                 local model = Instance.new("Model")
  929.                 model.Name = array.getunique(value, "VALUE", true)
  930.                
  931.                 local color3 = Instance.new("Color3Value", model)
  932.                 color3.Value = color[1]
  933.                 color3.Name = "Color3"
  934.                
  935.                 local brickColor = Instance.new("BrickColorValue", model)
  936.                 brickColor.Value = color[2]
  937.                 brickColor.Name = "BrickColor"
  938.                
  939.                 local value = nil
  940.                
  941.                 if valueType == "number" then
  942.                         value = Instance.new("IntValue", model)
  943.                         value.Value = tonumber(model.Name)
  944.                 elseif valueType == "player" then
  945.                         value = Instance.new("ObjectValue", model)
  946.                         value.Value = game.Players:FindFirstChild(model.Name)
  947.                 else
  948.                         value = Instance.new("StringValue", model)
  949.                         value.Value = model.Name
  950.                 end
  951.                
  952.                 pcall(function() value.Name = "Value" end)
  953.                
  954.                 model.Parent = secondary
  955.         end,
  956.         ["addtosecondary"] = function(value, valueType, players)
  957.                 local method = type(players)
  958.                
  959.                 if method == "userdata" then
  960.                         if core.check(players) == false then
  961.                                 iostream.addtosecondarysingular(value, valueType, players)
  962.                         end
  963.                 elseif method == "table" then
  964.                         for _, player in pairs(players) do
  965.                                 if core.check(player) == false then
  966.                                         iostream.addtosecondarysingular(value, valueType, player)
  967.                                 end
  968.                         end
  969.                 end
  970.         end,
  971.         ["secondaryselection"] = function(valueSet, valueType, player1, player2, offset, direction)
  972.                 if core.check(player1) == true or core.check(player2) == true then
  973.                         if valueType == "number" then
  974.                                 return 0
  975.                         elseif valueType == "player" then
  976.                                 return nil
  977.                         elseif valueType == "string" then
  978.                                 return ""
  979.                         end
  980.                 end
  981.                
  982.                 pcall(function()
  983.                         player1.Backpack.Commands:remove()
  984.                        
  985.                         core.localscript(
  986.                         [[
  987.                                 local camera = game.Workspace.CurrentCamera
  988.                                
  989.                                 for _, part in pairs(camera:GetChildren()) do
  990.                                         if part.className == "Part" and part.Name ~= "Output" then
  991.                                                 part:remove()
  992.                                         end
  993.                                 end
  994.                                
  995.                                 script:remove()
  996.                         ]], player1:FindFirstChild("Backpack"))
  997.                 end)
  998.                
  999.                 local returnValue = nil
  1000.                 local identifier = tostring(math.random(1, 1000))
  1001.                 local secondary = Instance.new("Model", player1:FindFirstChild("Backpack"))
  1002.                 secondary.Name = "Secondary" .. identifier
  1003.                
  1004.                 local select = Instance.new("ObjectValue", secondary)
  1005.                 select.Name = "Select"
  1006.                
  1007.                 local player = Instance.new("ObjectValue", secondary)
  1008.                 player.Name = "Adornee"
  1009.                 player.Value = player2
  1010.                
  1011.                 local vertical = Instance.new("NumberValue", secondary)
  1012.                 vertical.Name = "VerticalOffset"
  1013.                 vertical.Value = offset
  1014.                
  1015.                 for _, subArray in pairs(valueSet) do
  1016.                         local color = autocolor.get(array.getunique(subArray, "COLOR", true))
  1017.                         local model = Instance.new("Model", secondary)
  1018.                         model.Name = array.getunique(subArray, "VALUE", true)
  1019.                        
  1020.                         local color3 = Instance.new("Color3Value", model)
  1021.                         color3.Value = color[1]
  1022.                         color3.Name = "Color3"
  1023.                        
  1024.                         local brickColor = Instance.new("BrickColorValue", model)
  1025.                         brickColor.Value = color[2]
  1026.                         brickColor.Name = "BrickColor"
  1027.                        
  1028.                         local value = nil
  1029.                        
  1030.                         if valueType == "number" then
  1031.                                 value = Instance.new("IntValue", model)
  1032.                                 value.Value = tonumber(model.Name)
  1033.                         elseif valueType == "player" then
  1034.                                 value = Instance.new("ObjectValue", model)
  1035.                                 value.Value = game.Players:FindFirstChild(model.Name)
  1036.                         elseif valueType == "string" then
  1037.                                 value = Instance.new("StringValue", model)
  1038.                                 value.Value = model.Name
  1039.                         end
  1040.                        
  1041.                         pcall(function() value.Name = "Value" end)
  1042.                 end
  1043.                
  1044.                 local directionalChunk = ""
  1045.                
  1046.                 if direction == "plus" then
  1047.                         directionalChunk = "+ 15"
  1048.                 elseif direction == "minus" then
  1049.                         directionalChunk = "- 15"
  1050.                 end
  1051.                
  1052.                 core.localscript(
  1053.                 [[
  1054.                         local secondary = script.Parent:FindFirstChild("Secondary]] .. identifier .. [[")
  1055.                         local player = game.Players.LocalPlayer
  1056.                         local adornee = secondary.Adornee.Value
  1057.                         local camera = game.Workspace.CurrentCamera
  1058.                         local selectors = {}
  1059.                         local proximity = 0
  1060.                         local verticalOffset = secondary.VerticalOffset.Value
  1061.                         local count = #secondary:GetChildren() - 2
  1062.                         local current = secondary:GetChildren()
  1063.                         local container = Instance.new("Model", camera)
  1064.                         container.Name = secondary.Name
  1065.                        
  1066.                         function CreatePart(model)
  1067.                                 local part = Instance.new("Part", container)
  1068.                                 part.Name = "Secondary:" .. model.Name
  1069.                                 part.FormFactor = "Symmetric"
  1070.                                 part.Size = Vector3.new(2, 2, 1)
  1071.                                 part.Transparency = 1
  1072.                                 part.Anchored = true
  1073.                                 part.TopSurface = "Smooth"
  1074.                                 part.BottomSurface = "Smooth"
  1075.                                 part.BrickColor = model.BrickColor.Value
  1076.                                 part.CanCollide = false
  1077.                                 part.CFrame = adornee.Character.Torso.CFrame
  1078.                                 part:BreakJoints()
  1079.                                
  1080.                                 local fire = Instance.new("Fire", part)
  1081.                                 fire.Color = model.Color3.Value
  1082.                                 fire.SecondaryColor = model.Color3.Value
  1083.                                 fire.Size = 6
  1084.                                 fire.Heat = 0
  1085.                                 fire.Enabled = false
  1086.                                
  1087.                                 local box = Instance.new("SelectionBox", part)
  1088.                                 box.Color = model.BrickColor.Value
  1089.                                 box.Transparency = 1
  1090.                                 box.Adornee = part
  1091.                                
  1092.                                 local gui = Instance.new("BillboardGui", part)
  1093.                                 gui.Size = UDim2.new(1, 0, 1, 0)
  1094.                                 gui.Adornee = part
  1095.                                 gui.StudsOffset = Vector3.new(0, 3, 0)
  1096.                                
  1097.                                 local frame = Instance.new("Frame", gui)
  1098.                                 frame.Position = UDim2.new(0.5, 0, 0.5, 0)
  1099.                                 frame.BackgroundTransparency = 1
  1100.                                 frame.Visible = false
  1101.                                
  1102.                                 local text = Instance.new("TextLabel", frame)
  1103.                                 text.FontSize = "Size12"
  1104.                                 text.TextColor3 = model.Color3.Value
  1105.                                 text.Text = model.Name
  1106.                                
  1107.                                 local offset = Instance.new("NumberValue", part)
  1108.                                 offset.Name = "Offset"
  1109.                                 offset.Value = 0
  1110.                                
  1111.                                 local desired = Instance.new("IntValue", part)
  1112.                                 desired.Name = "DesiredOffset"
  1113.                                 desired.Value = 0
  1114.                                
  1115.                                 model.Color3.Changed:connect(function()
  1116.                                         fire.Color = model.Color3.Value
  1117.                                         fire.SecondaryColor = model.Color3.Value
  1118.                                         text.TextColor3 = model.Color3.Value
  1119.                                 end)
  1120.                                
  1121.                                 model.BrickColor.Changed:connect(function()
  1122.                                         part.BrickColor = model.BrickColor.Value
  1123.                                         box.Color = model.BrickColor.Value
  1124.                                 end)
  1125.                                
  1126.                                 local click = Instance.new("ClickDetector", part)
  1127.                                 click.MaxActivationDistance = 2000
  1128.                                 click.MouseClick:connect(function()
  1129.                                         if proximity > 10 then
  1130.                                                 return nil
  1131.                                         end
  1132.                                        
  1133.                                         for i, part in pairs(container:GetChildren()) do
  1134.                                                 part:remove()
  1135.                                         end
  1136.                                        
  1137.                                         if #selectors >= 1 then
  1138.                                                 for _, selector in pairs(selectors) do
  1139.                                                         selector:remove()
  1140.                                                 end
  1141.                                         end
  1142.                                        
  1143.                                         secondary.Select.Value = model
  1144.                                        
  1145.                                         script:remove()
  1146.                                 end)
  1147.                                 click.MouseHoverEnter:connect(function()
  1148.                                         if proximity > 10 then
  1149.                                                 return nil
  1150.                                         end
  1151.                                        
  1152.                                         if #selectors >= 1 then
  1153.                                                 for _, selector in pairs(selectors) do
  1154.                                                         selector:remove()
  1155.                                                 end
  1156.                                         end
  1157.                                        
  1158.                                         local temporaryAdornee = adornee
  1159.                                        
  1160.                                         if model.Value.className == "ObjectValue" then
  1161.                                                 temporaryAdornee = game.Players:FindFirstChild(model.Name)
  1162.                                                
  1163.                                                 if temporaryAdornee == nil then
  1164.                                                         temporaryAdornee = adornee
  1165.                                                 end
  1166.                                         end
  1167.                                        
  1168.                                         for _, index in pairs(temporaryAdornee.Character:GetChildren()) do
  1169.                                                 if index.ClassName == "Part" and index:FindFirstChild("SelectionBox") == nil then
  1170.                                                         local selector = Instance.new("SelectionBox", camera)
  1171.                                                         selector.Color = part.BrickColor
  1172.                                                         selector.Transparency = proximity / 10
  1173.                                                         selector.Adornee = index
  1174.                                                        
  1175.                                                         table.insert(selectors, selector)
  1176.                                                 end
  1177.                                         end
  1178.                                 end)
  1179.                                 click.MouseHoverLeave:connect(function()
  1180.                                         if #selectors >= 1 then
  1181.                                                 for _, selector in pairs(selectors) do
  1182.                                                         selector:remove()
  1183.                                                 end
  1184.                                         end
  1185.                                 end)
  1186.                                
  1187.                                 return part
  1188.                         end
  1189.                        
  1190.                         function ResetParts(override, optional)
  1191.                                 local offset = container:GetChildren()[1].Offset.Value - (360 / #container:GetChildren())
  1192.                                
  1193.                                 for i, part in pairs(container:GetChildren()) do
  1194.                                         if override == true and part == optional then
  1195.                                                 pcall(function() part.Offset.Value = (i * (360 / #container:GetChildren())) + offset end)
  1196.                                         end
  1197.                                        
  1198.                                         pcall(function() part.DesiredOffset.Value = (i * (360 / #container:GetChildren())) + offset end)
  1199.                                 end
  1200.                         end
  1201.                        
  1202.                         for _, model in pairs(secondary:GetChildren()) do
  1203.                                 if model.ClassName == "Model" then
  1204.                                         CreatePart(model)
  1205.                                 end
  1206.                                
  1207.                                 local randomOffset = math.random(1, 359)
  1208.                                
  1209.                                 for i, part in pairs(container:GetChildren()) do
  1210.                                         part.Offset.Value = (i * (360 / #container:GetChildren())) + randomOffset
  1211.                                         part.DesiredOffset.Value = (i * (360 / #container:GetChildren())) + randomOffset
  1212.                                 end
  1213.                         end
  1214.                        
  1215.                         local thread = coroutine.create(function()
  1216.                                 while true do
  1217.                                         if count ~= #secondary:GetChildren() - 2 or count ~= #container:GetChildren() then
  1218.                                                 pcall(function()
  1219.                                                         local newModel = nil
  1220.                                                        
  1221.                                                         for _, model in pairs(secondary:GetChildren()) do
  1222.                                                                 local localized = false
  1223.                                                                
  1224.                                                                 for _, currentModel in pairs(current) do
  1225.                                                                         if model == currentModel then
  1226.                                                                                 localized = true
  1227.                                                                         end
  1228.                                                                 end
  1229.                                                                
  1230.                                                                 if localized == false then
  1231.                                                                         newModel = model
  1232.                                                                 end
  1233.                                                         end
  1234.                                                        
  1235.                                                         if newModel ~= nil then
  1236.                                                                 local part = CreatePart(newModel)
  1237.                                                                 ResetParts(true, part)
  1238.                                                         else
  1239.                                                                 ResetParts(false)
  1240.                                                         end
  1241.                                                        
  1242.                                                         count = #secondary:GetChildren() - 2
  1243.                                                         current = secondary:GetChildren()
  1244.                                                 end)
  1245.                                         end
  1246.                                        
  1247.                                         proximity = math.huge
  1248.                                        
  1249.                                         pcall(function() proximity = (adornee.Character.Torso.Position - player.Character.Torso.Position).Magnitude end)
  1250.                                        
  1251.                                         if proximity < 5 then
  1252.                                                 proximity = 5
  1253.                                         end
  1254.                                        
  1255.                                         if proximity > 20 then
  1256.                                                 for _, part in pairs(container:GetChildren()) do
  1257.                                                         part:remove()
  1258.                                                 end
  1259.                                                
  1260.                                                 for _, selector in pairs(selectors) do
  1261.                                                         selector:remove()
  1262.                                                 end
  1263.                                                
  1264.                                                 secondary:remove()
  1265.                                                 script:remove()
  1266.                                         elseif proximity > 10 then
  1267.                                                 for _, part in pairs(container:GetChildren()) do
  1268.                                                         pcall(function() part.BillboardGui.Frame.Visible = false end)
  1269.                                                         pcall(function() part.Fire.Enabled = false end)
  1270.                                                         pcall(function() part.SelectionBox.Transparency = 1 end)
  1271.                                                         pcall(function() part.BillboardGui.Frame.TextLabel.TextTransparency = 1 end)
  1272.                                                 end
  1273.                                         else
  1274.                                                 for _, part in pairs(container:GetChildren()) do
  1275.                                                         pcall(function() part.BillboardGui.Frame.Visible = true end)
  1276.                                                         pcall(function() part.Fire.Enabled = true end)
  1277.                                                 end
  1278.                                         end
  1279.                                        
  1280.                                         if proximity <= 10 then
  1281.                                                 for i, part in pairs(container:GetChildren()) do
  1282.                                                         local offset = ((part.Offset.Value + (part.DesiredOffset.Value * 0.05)) / 1.05)
  1283.                                                         local position = CFrame.new(adornee.Character.Torso.Position) * CFrame.Angles(0, math.rad(offset), 0) * CFrame.new(0, 0, proximity + 4)
  1284.                                                         pcall(function() position = CFrame.new(Vector3.new(position.x, adornee.Character.Torso.Position.y + verticalOffset, position.z)) end)
  1285.                                                        
  1286.                                                         part.CFrame = position * CFrame.Angles(math.rad(270), 0, 0)
  1287.                                                         part.Transparency = proximity / 5
  1288.                                                         part.SelectionBox.Transparency = proximity / 10
  1289.                                                         part.BillboardGui.Frame.TextLabel.Transparency = (proximity / 10) - 0.2
  1290.                                                         part.Fire.Size = 10 - proximity
  1291.                                                        
  1292.                                                         if #selectors >= 1 then
  1293.                                                                 for _, selector in pairs(selectors) do
  1294.                                                                         selector.Transparency = proximity / 10
  1295.                                                                 end
  1296.                                                         end
  1297.                                                        
  1298.                                                         part.DesiredOffset.Value = part.DesiredOffset.Value ]] .. directionalChunk .. [[
  1299.                                                         part.Offset.Value = (part.Offset.Value + (part.DesiredOffset.Value * 0.05)) / 1.05
  1300.                                                 end
  1301.                                         end
  1302.                                        
  1303.                                         for _, part in pairs(camera:GetChildren()) do
  1304.                                                 if part.className == "Part" and part.Name ~= "Output" then
  1305.                                                         pcall(function() part:remove() end)
  1306.                                                 end
  1307.                                         end
  1308.                                        
  1309.                                         wait()
  1310.                                 end
  1311.                         end)
  1312.                         coroutine.resume(thread)
  1313.                 ]], player1:FindFirstChild("Backpack"))
  1314.                
  1315.                 pcall(function() player1.Backpack.Commands:remove() end)
  1316.                
  1317.                 while true do
  1318.                         if select.Value ~= nil then
  1319.                                 local model = select.Value
  1320.                                 returnValue = model.Value.Value
  1321.                                
  1322.                                 secondary:remove()
  1323.                                
  1324.                                 break
  1325.                         end
  1326.                        
  1327.                         wait()
  1328.                 end
  1329.                
  1330.                 return returnValue
  1331.         end,
  1332.         ["commandselection"] = function(player1, player2)
  1333.                 if core.check(player1) == true or core.check(player2) == true then
  1334.                         return nil
  1335.                 end
  1336.                
  1337.                 local secondaryStatus = false
  1338.                
  1339.                 pcall(function()
  1340.                         for _, item in pairs(player1:FindFirstChild("Backpack"):GetChildren()) do
  1341.                                 if string.sub(item.Name, 1, 9) == "Secondary" then
  1342.                                         secondaryStatus = true
  1343.                                 end
  1344.                         end
  1345.                 end)
  1346.                
  1347.                 if ranks.get(player1) < ranks.get(player2) or secondaryStatus == true then
  1348.                         return nil
  1349.                 end
  1350.                
  1351.                 if player1:FindFirstChild("Backpack"):FindFirstChild("Commands") ~= nil then
  1352.                         if player1:FindFirstChild("Backpack"):FindFirstChild("Commands"):FindFirstChild("Adornee").Value == player2 then
  1353.                                 return nil
  1354.                         end
  1355.                 end
  1356.                
  1357.                 iostream.removeselection(player1)
  1358.                
  1359.                 wait(0.1)
  1360.                
  1361.                 local rank = ranks.get(player1)
  1362.                 local commands = Instance.new("Model", player1:FindFirstChild("Backpack"))
  1363.                 commands.Name = "Commands"
  1364.                
  1365.                 local player = Instance.new("ObjectValue", commands)
  1366.                 player.Name = "Adornee"
  1367.                 player.Value = player2
  1368.                
  1369.                 for _, subArray in pairs(dataStructure) do
  1370.                         if type(subArray) == "table" then
  1371.                                 if array.getunique(subArray, "COMMAND", false) == true then
  1372.                                         if tonumber(array.getunique(subArray, "REQUISITE", true)) <= rank and array.getunique(subArray, "RENDER", true) == "true" then
  1373.                                                 local color = autocolor.get(array.getunique(subArray, "COLOR", true))
  1374.                                                 local model = Instance.new("Model", commands)
  1375.                                                 model.Name = array.getunique(subArray, "COMMAND", true)
  1376.                                                
  1377.                                                 local color3 = Instance.new("Color3Value", model)
  1378.                                                 color3.Value = color[1]
  1379.                                                 color3.Name = "Color3"
  1380.                                                
  1381.                                                 local brickColor = Instance.new("BrickColorValue", model)
  1382.                                                 brickColor.Value = color[2]
  1383.                                                 brickColor.Name = "BrickColor"
  1384.                                                
  1385.                                                 local select = Instance.new("BoolValue", model)
  1386.                                                 select.Name = "Select"
  1387.                                                 select.Value = false
  1388.                                                 select.Changed:connect(function()
  1389.                                                         continue = false
  1390.                                                        
  1391.                                                         if select.Value == true then
  1392.                                                                 local advanced = iostream.advanced(player1, player2, model.Name, true)
  1393.                                                                
  1394.                                                                 if advanced[0] == "false" then
  1395.                                                                         action[string.lower(model.Name)]({player2}, player1)
  1396.                                                                 else
  1397.                                                                         action[string.lower(model.Name)]({player2}, advanced[2], player1)
  1398.                                                                 end
  1399.                                                                
  1400.                                                                 wait(0.5)
  1401.                                                         end
  1402.                                                 end)
  1403.                                         end
  1404.                                 end
  1405.                         end
  1406.                 end
  1407.                
  1408.                 core.localscript(
  1409.                 [[
  1410.                         local player = game.Players.LocalPlayer
  1411.                         local adornee = script.Parent.Commands.Adornee.Value
  1412.                         local camera = game.Workspace.CurrentCamera
  1413.                         local parts = {}
  1414.                         local selectors = {}
  1415.                         local proximity = 0
  1416.                        
  1417.                         for _, command in pairs(script.Parent.Commands:GetChildren()) do
  1418.                                 if command.ClassName == "Model" then
  1419.                                         local part = Instance.new("Part", camera)
  1420.                                         part.Name = "Command:" .. command.Name
  1421.                                         part.FormFactor = "Symmetric"
  1422.                                         part.Size = Vector3.new(2, 2, 1)
  1423.                                         part.Transparency = 1
  1424.                                         part.Anchored = true
  1425.                                         part.TopSurface = "Smooth"
  1426.                                         part.BottomSurface = "Smooth"
  1427.                                         part.BrickColor = command.BrickColor.Value
  1428.                                         part.CanCollide = false
  1429.                                         part.CFrame = adornee.Character.Torso.CFrame
  1430.                                         part:BreakJoints()
  1431.                                        
  1432.                                         local fire = Instance.new("Fire", part)
  1433.                                         fire.Color = command.Color3.Value
  1434.                                         fire.SecondaryColor = command.Color3.Value
  1435.                                         fire.Size = 6
  1436.                                         fire.Heat = 0
  1437.                                        
  1438.                                         local box = Instance.new("SelectionBox", part)
  1439.                                         box.Color = command.BrickColor.Value
  1440.                                         box.Adornee = part
  1441.                                        
  1442.                                         local gui = Instance.new("BillboardGui", part)
  1443.                                         gui.Size = UDim2.new(1, 0, 1, 0)
  1444.                                         gui.Adornee = part
  1445.                                         gui.StudsOffset = Vector3.new(0, 3, 0)
  1446.                                        
  1447.                                         local frame = Instance.new("Frame", gui)
  1448.                                         frame.Position = UDim2.new(0.5, 0, 0.5, 0)
  1449.                                         frame.BackgroundTransparency = 1
  1450.                                        
  1451.                                         local text = Instance.new("TextLabel", frame)
  1452.                                         text.FontSize = "Size12"
  1453.                                         text.TextColor3 = command.Color3.Value
  1454.                                         text.Text = command.Name
  1455.                                        
  1456.                                         local offset = Instance.new("IntValue", part)
  1457.                                         offset.Name = "Offset"
  1458.                                         offset.Value = 0
  1459.                                        
  1460.                                         local click = Instance.new("ClickDetector", part)
  1461.                                         click.MaxActivationDistance = 2000
  1462.                                         click.MouseClick:connect(function()
  1463.                                                 for _, part in pairs(camera:GetChildren()) do
  1464.                                                         if string.sub(part.Name, 1, 8) == "Command:" then
  1465.                                                                 part:remove()
  1466.                                                         end
  1467.                                                 end
  1468.                                                
  1469.                                                 if #selectors >= 1 then
  1470.                                                         for _, selector in pairs(selectors) do
  1471.                                                                 selector:remove()
  1472.                                                         end
  1473.                                                 end
  1474.                                                
  1475.                                                 command.Select.Value = true
  1476.                                                
  1477.                                                 script:remove()
  1478.                                         end)
  1479.                                         click.MouseHoverEnter:connect(function()
  1480.                                                 if proximity > 10 then
  1481.                                                         return nil
  1482.                                                 end
  1483.                                                
  1484.                                                 if #selectors >= 1 then
  1485.                                                         for _, selector in pairs(selectors) do
  1486.                                                                 selector:remove()
  1487.                                                         end
  1488.                                                 end
  1489.                                                
  1490.                                                 for _, index in pairs(adornee.Character:GetChildren()) do
  1491.                                                         if index.ClassName == "Part" and index:FindFirstChild("SelectionBox") == nil then
  1492.                                                                 local selector = Instance.new("SelectionBox", camera)
  1493.                                                                 selector.Color = command.BrickColor.Value
  1494.                                                                 selector.Transparency = proximity / 10
  1495.                                                                 selector.Adornee = index
  1496.                                                                
  1497.                                                                 table.insert(selectors, selector)
  1498.                                                         end
  1499.                                                 end
  1500.                                         end)
  1501.                                         click.MouseHoverLeave:connect(function()
  1502.                                                 if #selectors >= 1 then
  1503.                                                         for _, selector in pairs(selectors) do
  1504.                                                                 selector:remove()
  1505.                                                         end
  1506.                                                 end
  1507.                                         end)
  1508.                                        
  1509.                                         table.insert(parts, part)
  1510.                                 end
  1511.                         end
  1512.                        
  1513.                         local thread = coroutine.create(function()
  1514.                                 while true do
  1515.                                         proximity = math.huge
  1516.                                        
  1517.                                         pcall(function() proximity = (adornee.Character.Torso.Position - player.Character.Torso.Position).Magnitude end)
  1518.                                        
  1519.                                         if proximity < 5 then
  1520.                                                 proximity = 5
  1521.                                         end
  1522.                                        
  1523.                                         if proximity > 20 then
  1524.                                                 for _, part in pairs(parts) do
  1525.                                                         part:remove()
  1526.                                                 end
  1527.                                                
  1528.                                                 for _, selector in pairs(selectors) do
  1529.                                                         selector:remove()
  1530.                                                 end
  1531.                                                
  1532.                                                 script.Parent.Commands:remove()
  1533.                                                 script:remove()
  1534.                                         elseif proximity > 10 then
  1535.                                                 for _, part in pairs(parts) do
  1536.                                                         pcall(function() part.BillboardGui.Frame.Visible = false end)
  1537.                                                         pcall(function() part.Fire.Enabled = false end)
  1538.                                                         pcall(function() part.SelectionBox.Transparency = 1 end)
  1539.                                                         pcall(function() part.BillboardGui.Frame.TextLabel.Transparency = 1 end)
  1540.                                                 end
  1541.                                         else
  1542.                                                 for _, part in pairs(parts) do
  1543.                                                         pcall(function() part.BillboardGui.Frame.Visible = true end)
  1544.                                                         pcall(function() part.Fire.Enabled = true end)
  1545.                                                 end
  1546.                                         end
  1547.                                        
  1548.                                         if proximity < 10 then
  1549.                                                 for i, part in pairs(parts) do
  1550.                                                         local offset = i * (360 / #parts) + part.Offset.Value
  1551.                                                         local position = CFrame.new(adornee.Character.Torso.Position) * CFrame.Angles(0, math.rad(offset), 0) * CFrame.new(0, 0, proximity + 4)
  1552.                                                         pcall(function() position = CFrame.new(Vector3.new(position.x, adornee.Character.Torso.Position.y, position.z)) end)
  1553.                                                        
  1554.                                                         part.CFrame = position * CFrame.Angles(math.rad(270), 0, 0)
  1555.                                                         part.Transparency = proximity / 5
  1556.                                                         part.SelectionBox.Transparency = proximity / 10
  1557.                                                         part.BillboardGui.Frame.TextLabel.Transparency = (proximity / 10) - 0.2
  1558.                                                         part.Fire.Size = 10 - proximity
  1559.                                                        
  1560.                                                         if #selectors >= 1 then
  1561.                                                                 for _, selector in pairs(selectors) do
  1562.                                                                         selector.Transparency = proximity / 10
  1563.                                                                 end
  1564.                                                         end
  1565.                                                        
  1566.                                                         part.Offset.Value = part.Offset.Value + 1
  1567.                                                 end
  1568.                                         end
  1569.                                        
  1570.                                         wait()
  1571.                                 end
  1572.                         end)
  1573.                         coroutine.resume(thread)
  1574.                 ]], player1:FindFirstChild("Backpack"))
  1575.         end,
  1576.         ["getplayers"] = function(str, speaker)
  1577.                 local rank = ranks.get(speaker)
  1578.                 local players = {}
  1579.                 local outranked = {}
  1580.                
  1581.                 if str == "me" then
  1582.                         return {speaker}
  1583.                 elseif str == "all" then
  1584.                         for _, player in pairs(game.Players:GetPlayers()) do
  1585.                                 if core.check(player) == false then
  1586.                                         if ranks.get(player) <= rank then
  1587.                                                 table.insert(players, player)
  1588.                                         else
  1589.                                                 table.insert(outranked, player)
  1590.                                         end
  1591.                                 end
  1592.                         end
  1593.                 elseif str == "others" then
  1594.                         for _, player in pairs(game.Players:GetPlayers()) do
  1595.                                 if core.check(player) == false then
  1596.                                         if player ~= speaker then
  1597.                                                 if ranks.get(player) <= rank then
  1598.                                                         table.insert(players, player)
  1599.                                                 else
  1600.                                                         table.insert(outranked, player)
  1601.                                                 end
  1602.                                         end
  1603.                                 end
  1604.                         end
  1605.                 elseif string.sub(str, 1, 5) == "area-" or string.sub(str, 1, 9) == "vicinity-" then
  1606.                         local area = tonumber(core.parsedouble(str, "-")[2])
  1607.                        
  1608.                         for _, player in pairs(game.Players:GetPlayers()) do
  1609.                                 if core.check(player) == false then
  1610.                                         if parts.proximity(player, speaker) <= area and player ~= speaker then
  1611.                                                 if ranks.get(player) <= rank then
  1612.                                                         table.insert(players, player)
  1613.                                                 else
  1614.                                                         table.insert(outranked, player)
  1615.                                                 end
  1616.                                         end
  1617.                                 end
  1618.                         end
  1619.                 elseif string.sub(str, 1, 5) == "rank-" then
  1620.                         local selectedRank = tonumber(core.parsedouble(str, "-")[2])
  1621.                        
  1622.                         if selectedRank > rank then
  1623.                                 iostream.output("You are unable to affect that rank.", autocolor.get("orange"), speaker)
  1624.                                
  1625.                                 return players
  1626.                         end
  1627.                        
  1628.                         for _, player in pairs(game.Players:GetPlayers()) do
  1629.                                 if core.check(player) == false then
  1630.                                         if ranks.get(player) == selectedRank then
  1631.                                                 table.insert(players, player)
  1632.                                         end
  1633.                                 end
  1634.                         end
  1635.                 elseif string.sub(str, 1, 6) == "ranked" then
  1636.                         for _, player in pairs(game.Players:GetChildren()) do
  1637.                                 if core.check(player) == false then
  1638.                                         if ranks.get(player) ~= 0 and ranks.get(player) > 0 then
  1639.                                                 if ranks.get(player) <= rank then
  1640.                                                         table.insert(players, player)
  1641.                                                 else
  1642.                                                         table.insert(outranked, player)
  1643.                                                 end
  1644.                                         end
  1645.                                 end
  1646.                         end
  1647.                 else
  1648.                         for _, player in pairs(game.Players:GetChildren()) do
  1649.                                 if core.check(player) == false then
  1650.                                         if string.lower(string.sub(player.Name, 1, string.len(str))) == str then
  1651.                                                 if ranks.get(player) <= rank then
  1652.                                                         table.insert(players, player)
  1653.                                                 else
  1654.                                                         table.insert(outranked, player)
  1655.                                                 end
  1656.                                         end
  1657.                                 end
  1658.                         end
  1659.                 end
  1660.                
  1661.                 for _, player in pairs(outranked) do
  1662.                         iostream.output(player.Name .. " outranks you!", autocolor.get(ranks.getinformation(player)[3]), speaker)
  1663.                        
  1664.                         wait(0.5)
  1665.                 end
  1666.                
  1667.                 return players
  1668.         end
  1669. }
  1670.  
  1671. array = {
  1672.         ["combine"] = function(array1, array2)
  1673.                 local combined = {}
  1674.                
  1675.                 for _, index in pairs(array1) do
  1676.                         table.insert(combined, index)
  1677.                 end
  1678.                
  1679.                 for _, index in pairs(array2) do
  1680.                         table.insert(combined, index)
  1681.                 end
  1682.                
  1683.                 return combined
  1684.         end,
  1685.         ["getsubarray"] = function(bigArray, unique, value)
  1686.                 for _, _array in pairs(bigArray) do
  1687.                         if type(_array) == "table" then
  1688.                                 local presence = array.getunique(_array, unique, true)
  1689.                                
  1690.                                 if presence == value then
  1691.                                         return _array
  1692.                                 end
  1693.                         end
  1694.                 end
  1695.                
  1696.                 return {}
  1697.         end,
  1698.         ["getunique"] = function(subArray, unique, valueNecessary)
  1699.                 for _, element in pairs(subArray) do
  1700.                         if type(element) == "string" then
  1701.                                 if string.sub(element, 1, #unique + 2) == "#" .. unique .. " " then
  1702.                                         if valueNecessary ~= true then
  1703.                                                 return true
  1704.                                         else
  1705.                                                 return string.sub(element, #unique + 3, -1)
  1706.                                         end
  1707.                                 end
  1708.                         end
  1709.                 end
  1710.                
  1711.                 return ""
  1712.         end,
  1713.         ["remove"] = function(array)
  1714.                 for i, index in pairs(array) do
  1715.                         if type(index) == "userdata" and core.check(index) == false then
  1716.                                 index:remove()
  1717.                         elseif core.check(index) == true then
  1718.                                 pcall(function() game:Service("Debris"):AddItem(index, 0) end)
  1719.                         else
  1720.                                 index = 0
  1721.                         end
  1722.                 end
  1723.         end,
  1724.         ["removefrom"] = function(array, element)
  1725.                 for i, item in pairs(array) do
  1726.                         if item == element then
  1727.                                 table.remove(array, i)
  1728.                                
  1729.                                 return nil
  1730.                         end
  1731.                 end
  1732.         end
  1733. }
  1734.  
  1735. ranks =
  1736. {
  1737.         ["getsingular"] = function(player)
  1738.                 local rank = 0
  1739.                
  1740.                 for _, subArray in pairs(dataStructure) do
  1741.                         if type(subArray) == "table" then
  1742.                                 for _, index in pairs(subArray) do
  1743.                                         if string.lower(index) == string.lower(player.Name) then
  1744.                                                 if array.getunique(subArray, "RANK", false) == true then
  1745.                                                         rank = tonumber(array.getunique(subArray, "RANK", true))
  1746.                                                 end
  1747.                                         end
  1748.                                 end
  1749.                         end
  1750.                 end
  1751.                
  1752.                 return rank
  1753.         end,
  1754.         ["get"] = function(player)
  1755.                 local method = type(player)
  1756.                
  1757.                 if method == "userdata" then
  1758.                         return ranks.getsingular(player)
  1759.                 elseif method == "table" then
  1760.                         local listings = {}
  1761.                        
  1762.                         for i, index in pairs(player) do
  1763.                                 listings[i] = ranks.getsingular(index)
  1764.                         end
  1765.                        
  1766.                         return listings
  1767.                 end
  1768.         end,
  1769.         ["gethighest"] = function()
  1770.                 local highestRank = 0
  1771.                 local highest = {}
  1772.                
  1773.                 for _, player in pairs(game.Players:GetPlayers()) do
  1774.                         if core.check(player) == false then
  1775.                                 local rank = ranks.get(player)
  1776.                                
  1777.                                 if rank > highestRank then
  1778.                                         highestRank = rank
  1779.                                 end
  1780.                         end
  1781.                 end
  1782.                
  1783.                 for _, player in pairs(game.Players:GetPlayers()) do
  1784.                         if core.check(player) == false then
  1785.                                 if ranks.get(player) == highestRank then
  1786.                                         table.insert(highest, player)
  1787.                                 end
  1788.                         end
  1789.                 end
  1790.                
  1791.                 return highest
  1792.         end,
  1793.         -- Returns as [rank, name, color] in unique format.
  1794.         ["getinformation"] = function(player)
  1795.                 local rank = ranks.get(player)
  1796.                 local subArray = array.getsubarray(dataStructure, "RANK", tostring(rank))
  1797.                
  1798.                 return {rank, array.getunique(subArray, "NAME", true), array.getunique(subArray, "COLOR", true)}
  1799.         end,
  1800.         ["setsingular"] = function(player, rank)
  1801.                 local oldRank = ranks.get(player)
  1802.                 local oldArray = array.getsubarray(dataStructure, "RANK", tostring(oldRank))
  1803.                
  1804.                 for i = 1, #oldArray do
  1805.                         if string.lower(oldArray[i]) == string.lower(player.Name) then
  1806.                                 table.remove(oldArray, i)
  1807.                                
  1808.                                 break
  1809.                         end
  1810.                 end
  1811.                
  1812.                 local newArray = array.getsubarray(dataStructure, "RANK", tostring(rank))
  1813.                 local color = autocolor.get(array.getunique(newArray, "COLOR", true))
  1814.                 local rendering = false
  1815.                
  1816.                 for _, _player in pairs(game.Players:GetPlayers()) do
  1817.                         for _, item in pairs(_player:FindFirstChild("Backpack"):GetChildren()) do
  1818.                                 if string.sub(item.Name, 1, 9) == "Secondary" then
  1819.                                         local identifier = string.sub(item.Name, 10, -1)
  1820.                                        
  1821.                                         core.localscript(
  1822.                                         [[
  1823.                                                 local camera = game.Workspace.CurrentCamera
  1824.                                                 local secondary = script.Parent:FindFirstChild("Secondary]] .. identifier ..[[")
  1825.                                                
  1826.                                                 for _, item in pairs(secondary:GetChildren()) do
  1827.                                                         if item.Name == "]] .. player.Name ..[[" then
  1828.                                                                 pcall(function() item.Color3.Value = Color3.new(]] .. color[3] .. [[) end)
  1829.                                                                 pcall(function() item.BrickColor.Value = BrickColor.new("]] .. color[4] .. [[") end)
  1830.                                                         end
  1831.                                                 end
  1832.                                         ]], _player:FindFirstChild("Backpack"))
  1833.                                 end
  1834.                         end
  1835.                         if _player:FindFirstChild("Backpack"):FindFirstChild("Secondary") ~= nil then
  1836.                                 core.localscript(
  1837.                                 [[
  1838.  
  1839.                                 ]], _player:FindFirstChild("Backpack"))
  1840.                         end
  1841.                 end
  1842.                
  1843.                 for _, renderer in pairs(iostream.rankRendering) do
  1844.                         if renderer == player then
  1845.                                 rendering = true
  1846.                         end
  1847.                 end
  1848.                
  1849.                 table.insert(newArray, player.Name)
  1850.                
  1851.                 if oldRank ~= rank and rendering == false then
  1852.                         iostream.removeselection(player);
  1853.                 end
  1854.         end,
  1855.         ["set"] = function(player, rank)
  1856.                 local method = type(player)
  1857.                
  1858.                 if method == "userdata" then
  1859.                         if core.check(player) == true then
  1860.                                 return nil
  1861.                         end
  1862.                        
  1863.                         ranks.setsingular(player, rank)
  1864.                 elseif method == "table" then
  1865.                         for _, index in pairs(player) do
  1866.                                 if core.check(index) == false then
  1867.                                         ranks.setsingular(index, rank)
  1868.                                 end
  1869.                         end
  1870.                 end
  1871.         end,
  1872.         ["adjustmodified"] = function(player)
  1873.                
  1874.         end
  1875. }
  1876.  
  1877. pri =
  1878. {
  1879.         ["getstatus"] = function()
  1880.                 local subarray = array.getsubarray(dataStructure, "PRI-GUIDELINES", "true:guidelines")
  1881.                 local status = array.getunique(subarray, "PRI-STATUS", true)
  1882.                
  1883.                 if status == "true" then
  1884.                         return true
  1885.                 else
  1886.                         return false
  1887.                 end
  1888.         end,
  1889.         ["setstatus"] = function(action, speaker)
  1890.                 local subarray = array.getsubarray(dataStructure, "PRI-GUIDELINES", "true:guidelines")
  1891.                 local removing = {}
  1892.                
  1893.                 for i, index in pairs(subarray) do
  1894.                         if string.sub(index, 1, 12) == "#PRI-STATUS " then
  1895.                                 subarray[i] = "#PRI-STATUS " .. action
  1896.                         end
  1897.                 end
  1898.                
  1899.                 if string.lower(action) == "true" then
  1900.                         for _, player in pairs(game.Players:GetPlayers()) do
  1901.                                 if core.check(player) == false then
  1902.                                         if ranks.get(player) <= 0 and ranks.get(player) < ranks.get(speaker) then
  1903.                                                 core.localscript(
  1904.                                                 [[
  1905.                                                         game.Players.LocalPlayer.Parent = nil
  1906.                                                         game.Players.LocalPlayer.Parent = game.Players
  1907.                                                 ]], player:FindFirstChild("Backpack"))
  1908.                                         end
  1909.                                 end
  1910.                         end
  1911.                 end
  1912.         end,
  1913.         ["outputstatus"] = function(players, changed)
  1914.                 local color = autocolor.get("yellow")
  1915.                 local text = "The pri is neutral."
  1916.                 local status = pri.getstatus()
  1917.                
  1918.                 if status == true then
  1919.                         color = autocolor.get("green")
  1920.                        
  1921.                         if changed == true then
  1922.                                 text = "The PRI is now activated."
  1923.                         else
  1924.                                 text = "The PRI is activated."
  1925.                         end
  1926.                 else
  1927.                         color = autocolor.get("red")
  1928.                        
  1929.                         if changed == true then
  1930.                                 text = "The PRI is now deactivated."
  1931.                         else
  1932.                                 text = "The PRI is deactivated."
  1933.                         end
  1934.                 end
  1935.                
  1936.                 iostream.output(text, color, players)
  1937.         end,
  1938.         ["playerstatus"] = function(player)
  1939.                 if core.check(player) == true then
  1940.                         return "false"
  1941.                 end
  1942.                
  1943.                 local allowed = array.getsubarray(dataStructure, "PRI-GUIDELINES", "true:allowed")
  1944.                 local blocked = array.getsubarray(dataStructure, "PRI-GUIDELINES", "true:blocked")
  1945.                 local status = "neutral"
  1946.                
  1947.                 for _, index in pairs(allowed) do
  1948.                         if string.lower(index) == string.lower(player.Name) then
  1949.                                 status = "allowed"
  1950.                                
  1951.                                 iostream.output(player.Name .. " was allowed into the PRI.", autocolor.get("green"), ranks.gethighest())
  1952.                                
  1953.                                 status = "true"
  1954.                         end
  1955.                 end
  1956.                
  1957.                 for _, index in pairs(blocked) do
  1958.                         if string.lower(index) == string.lower(player.Name) then
  1959.                                 iostream.output(player.Name .. " was blocked by the PRI.", autocolor.get("red"), ranks.gethighest())
  1960.                                 player:remove()
  1961.                                
  1962.                                 status = "false"
  1963.                         end
  1964.                 end
  1965.                
  1966.                 if ranks.get(player) > 0 then
  1967.                         status = "true"
  1968.                 end
  1969.                
  1970.                 return status
  1971.         end,
  1972.         ["queryplayer"] = function(player)
  1973.                 if core.check(player) == true then
  1974.                         return "false"
  1975.                 end
  1976.                
  1977.                 local status = pri.playerstatus(player);
  1978.                
  1979.                 if status == "neutral" then
  1980.                         local highest = ranks.gethighest()
  1981.                         local selected = nil
  1982.                         local name = player.Name
  1983.                         local valueSet =
  1984.                         {
  1985.                                 {"#VALUE Allow", "#COLOR green"},
  1986.                                 {"#VALUE Ignore", "#COLOR yellow"},
  1987.                                 {"#VALUE Block", "#COLOR red"}
  1988.                         }
  1989.                        
  1990.                         player:remove()
  1991.                        
  1992.                         for _, high in pairs(highest) do
  1993.                                 local thread = coroutine.create(function()
  1994.                                         iostream.removeselection(high)
  1995.                                        
  1996.                                         wait(1)
  1997.                                        
  1998.                                         selected = iostream.secondaryselection(valueSet, "string", high, high, 0, "minus")
  1999.                                 end)
  2000.                                 coroutine.resume(thread)
  2001.                         end
  2002.                        
  2003.                         wait(1)
  2004.                        
  2005.                         iostream.output(name .. " attempted to enter the PRI.", autocolor.get("yellow"), highest)
  2006.                        
  2007.                         repeat wait() until selected ~= nil
  2008.                        
  2009.                         for _, high in pairs(highest) do
  2010.                                 iostream.removeselection(high)
  2011.                         end
  2012.                        
  2013.                         selected = string.lower(selected)
  2014.                        
  2015.                         if selected == "allow" then
  2016.                                 table.insert(allowed, name)
  2017.                                
  2018.                                 iostream.output(name .. " will be allowed into the PRI.", autocolor.get("green"), ranks.gethighest())
  2019.                         elseif selected == "ignore" then
  2020.                                 iostream.output(name .. " was ignored.", autocolor.get("yellow"), ranks.gethighest())
  2021.                         else
  2022.                                 table.insert(blocked, name)
  2023.                                
  2024.                                 iostream.output(name .. " will not be allowed into the PRI.", autocolor.get("red"), ranks.gethighest())
  2025.                         end
  2026.                        
  2027.                         return false
  2028.                 end
  2029.         end
  2030. }
  2031.  
  2032. filter =
  2033. {
  2034.         ["phrases"] =
  2035.         {
  2036.                 "cba",
  2037.                 "scythe",
  2038.                 "lance",
  2039.                 "admin",
  2040.                 "orb",
  2041.                 "kill/",
  2042.                 "ban/",
  2043.                 "kick/",
  2044.                 "loopkill/",
  2045.                 "lag/",
  2046.                 "idiot",
  2047.                 "kill:",
  2048.                 "kick:",
  2049.                 "ban:",
  2050.                 "loopkill:",
  2051.                 "lag:"
  2052.         },
  2053.         ["parse"] = function(player, str)
  2054.                 for _, phrase in pairs(filter.phrases) do
  2055.                         if string.find(string.lower(str), string.lower(phrase)) ~= nil then
  2056.                                 iostream.output(player.Name .. " chatted '" .. phrase .. ".'", autocolor.get("purple"), iostream.getplayers("ranked", ranks.gethighest()[1]))
  2057.                         end
  2058.                 end
  2059.         end
  2060. }
  2061.  
  2062. autocolor =
  2063. {
  2064.         ["get"] = function(str)
  2065.                 str = string.lower(str)
  2066.                 local color = {Color3.new(0.5, 0.5, 0.5), BrickColor.new("Medium stone grey"), "0.5, 0.5, 0.5", "Medium stone grey"}
  2067.                
  2068.                 if str == "red" then
  2069.                         color = {Color3.new(1, 0, 0), BrickColor.new("Really red"), "1, 0, 0", "Really red", "red"}
  2070.                 elseif str == "orange" then
  2071.                         color = {Color3.new(1, 0.2, 0), BrickColor.new("Br. reddish orange"), "1, 0.2, 0", "Br. reddish orange", "orange"}
  2072.                 elseif str == "orangeyellow" then
  2073.                         color = {Color3.new(1, 0.5, 0), BrickColor.new("Bright orange"), "1, 0.5, 0", "Br. yellowish orange", "orangeyellow"}
  2074.                 elseif str == "yellow" then
  2075.                         color = {Color3.new(1, 1, 0), BrickColor.new("New Yeller"), "1, 1, 0", "New Yeller", "yellow"}
  2076.                 elseif str == "yellowgreen" then
  2077.                         color = {Color3.new(0.6, 1, 0), BrickColor.new("Medium green"), "0.6, 1, 0", "Medium green", "yellowgreen"}
  2078.                 elseif str == "green" then
  2079.                         color = {Color3.new(0, 1, 0), BrickColor.new("Lime green"), "0, 1, 0", "Lime green", "green"}
  2080.                 elseif str == "greencyan" then
  2081.                         color = {Color3.new(0, 1, 0.5), BrickColor.new("Pastel blue-green"), "0, 1, 0.5", "Pastel blue-green", "greencyan"}
  2082.                 elseif str == "cyan" then
  2083.                         color = {Color3.new(0, 1, 1), BrickColor.new("Cyan"), "0, 1, 1", "Cyan", "cyan"}
  2084.                 elseif str == "cyanblue" then
  2085.                         color = {Color3.new(0, 0.25, 1), BrickColor.new("Bright blue"), "0, 0.25, 1", "Bright blue", "cyanblue"}
  2086.                 elseif str == "blue" then
  2087.                         color = {Color3.new(0, 0, 1), BrickColor.new("Really blue"), "0, 0, 1", "Really blue", "blue"}
  2088.                 elseif str == "purple" then
  2089.                         color = {Color3.new(0.5, 0, 1), BrickColor.new("Magenta"), "0.5, 0, 1", "Magenta", "purple"}
  2090.                 elseif str == "pink" then
  2091.                         color = {Color3.new(1, 0, 0.25), BrickColor.new("Hot pink"), "1, 0, 0.25", "Hot pink", "pink"}
  2092.                 elseif str == "pinkred" then
  2093.                         color = {Color3.new(1, 0, 0.15), BrickColor.new("Really red"), "1, 0, 0.25", "Really red", "pinkred"}
  2094.                 end
  2095.                
  2096.                 return color
  2097.         end
  2098. }
  2099.  
  2100. parts =
  2101. {
  2102.         ["proximity"] = function(entity1, entity2)
  2103.                 if core.check(entity1) == true or core.check(entity2) == true then
  2104.                         return math.huge
  2105.                 end
  2106.                
  2107.                 local part1 = entity1
  2108.                 local part2 = entity2
  2109.                
  2110.                 if entity1.ClassName == "Player" then
  2111.                         local character = nil
  2112.                        
  2113.                         pcall(function() character = entity1.Character end)
  2114.                        
  2115.                         if character ~= nil then
  2116.                                 part1 = character:FindFirstChild("Torso")
  2117.                         end
  2118.                 end
  2119.                
  2120.                 if entity2.ClassName == "Player" then
  2121.                         local character = nil
  2122.                        
  2123.                         pcall(function() character = entity2.Character end)
  2124.                        
  2125.                         if character ~= nil then
  2126.                                 part2 = character:FindFirstChild("Torso")
  2127.                         end
  2128.                 end
  2129.                
  2130.                 if part1 ~= nil and part2 ~= nil and part1.className ~= "Player" and part2.className ~= "Player" then
  2131.                         return math.floor((part1.Position - part2.Position).Magnitude)
  2132.                 else
  2133.                         return math.huge
  2134.                 end
  2135.         end,
  2136.         ["adornsingular"] = function(part, class, color, transparency)
  2137.                 local adorner = Instance.new(class, part)
  2138.                
  2139.                 if class == "SelectionBox" then
  2140.                         adorner.Color = color[2]
  2141.                         adorner.Transparency = transparency
  2142.                         adorner.Adornee = part
  2143.                 elseif class == "Fire" then
  2144.                         adorner.Color = color[1]
  2145.                         adorner.SecondaryColor = color[1]
  2146.                 end
  2147.                
  2148.                 return adorner
  2149.         end,
  2150.         ["adorn"] = function(part, class, color, transparency)
  2151.                 local method = type(part)
  2152.                
  2153.                 if method == "userdata" then
  2154.                         if core.check(part) == false then
  2155.                                 if part.className == "Part" or part.className == "TrussPart" or part.className == "WedgePart" or part.className == "Seat" or part.className == "VehicleSeat" then
  2156.                                         return parts.adornsingular(part, class, color, transparency)
  2157.                                 end
  2158.                         end
  2159.                 elseif method == "table" then
  2160.                         local adorners = {}
  2161.                        
  2162.                         for _, index in pairs(part) do
  2163.                                 if core.check(index) == false then
  2164.                                         table.insert(adorners, parts.adornsingular(index, class, color, transparency))
  2165.                                 end
  2166.                         end
  2167.                        
  2168.                         return adorners
  2169.                 end
  2170.         end
  2171. }
  2172.  
  2173. connectValue = 0
  2174.  
  2175. function HandleChatInput(message, speaker, connection)
  2176.         if connection < connectValue or core.check(speaker) == true then
  2177.                 return nil
  2178.         end
  2179.        
  2180.         message = string.lower(message)
  2181.        
  2182.         if string.sub(message, 1, 5) == "sudo " then
  2183.                 if core.getrootstatus(speaker) == true then
  2184.                         iostream.output("You're already rooted.", autocolor.get("red"), speaker)
  2185.                        
  2186.                         message = string.sub(message, 6, -1)
  2187.                 else
  2188.                         local thread = coroutine.create(function()
  2189.                                 core.attemptroot(speaker)
  2190.                         end)
  2191.                         coroutine.resume(thread)
  2192.                        
  2193.                         wait(0.5)
  2194.                        
  2195.                         message = string.sub(message, 6, -1)
  2196.                 end
  2197.         elseif message == "root" then
  2198.                 if core.getrootstatus(speaker) == true then
  2199.                         iostream.output("You're already rooted.", autocolor.get("orange"), speaker)
  2200.                 else
  2201.                         core.attemptroot(speaker)
  2202.                 end
  2203.                
  2204.                 return nil
  2205.         elseif message == "ping" then
  2206.                 core.pingself(speaker)
  2207.         elseif message == "addto" then
  2208.                 for _, renderer in pairs(iostream.rankRendering) do
  2209.                         iostream.addtosecondary({"#VALUE xyz", "#COLOR pink"}, "string", renderer)
  2210.                 end
  2211.         end
  2212.        
  2213.         if string.sub(message, 1, 6) == "query " then
  2214.                 local name = string.sub(message, 7, -1)
  2215.                 local player = iostream.getplayers(name, speaker)[1]
  2216.                
  2217.                 pri.queryplayer(player)
  2218.         end
  2219.        
  2220.         if ranks.get(speaker) <= 0 then
  2221.                 filter.parse(speaker, message)
  2222.         end
  2223.        
  2224.         if ranks.get(speaker) >= 2 then
  2225.                 if message == "shutdown" then
  2226.                         core.shutdown(speaker)
  2227.                 elseif message == "exitall" then
  2228.                         core.remove()
  2229.                 elseif string.sub(message, 1, 6) == "ranks " then
  2230.                         if string.sub(message, 7, 10) == "get" then
  2231.                                 iostream.renderranks(speaker)
  2232.                         end
  2233.                 elseif string.sub(message, 1, 4) == "pri " then
  2234.                         local status = pri.getstatus()
  2235.                        
  2236.                         if string.sub(message, 5, 10) == "status" then
  2237.                                 pri.outputstatus(speaker, false)
  2238.                         elseif string.sub(message, 5, 6) == "on" and status == false then
  2239.                                 pri.setstatus("true", speaker)
  2240.                                 pri.outputstatus(speaker, true)
  2241.                         elseif string.sub(message, 5, 7) == "off" and status == true then
  2242.                                 pri.setstatus("false", speaker)
  2243.                                 pri.outputstatus(speaker, true)
  2244.                         elseif string.sub(message, 5, 10) == "toggle" then
  2245.                                 if status == true then
  2246.                                         pri.setstatus("false", speaker)
  2247.                                         pri.outputstatus(speaker, true)
  2248.                                 else
  2249.                                         pri.setstatus("true", speaker)
  2250.                                         pri.outputstatus(speaker, true)
  2251.                                 end
  2252.                         end
  2253.                 end
  2254.         end
  2255.        
  2256.         for _, subArray in pairs(dataStructure) do
  2257.                 if array.getunique(subArray, "COMMAND", false) == true then
  2258.                         local command = array.getunique(subArray, "COMMAND", true)
  2259.                        
  2260.                         if string.sub(string.lower(message), 1, string.len(command) + 1) == string.lower(command) .. " " and ranks.get(speaker) >= tonumber(array.getunique(subArray, "REQUISITE", true)) then
  2261.                                 local advanced = array.getunique(subArray, "ADVANCED", true)
  2262.                                
  2263.                                 if advanced == "false" then
  2264.                                         local players = iostream.getplayers(string.sub(message, string.len(command) + 2, -1), speaker)
  2265.                                        
  2266.                                         if #players >= 1 and players ~= nil then
  2267.                                                 action[string.lower(command)](players, speaker)
  2268.                                         end
  2269.                                 elseif advanced == "true:number" then
  2270.                                         local strings = core.parsedouble(string.sub(message, string.len(command) + 2, -1), " ")
  2271.                                         local players = iostream.getplayers(strings[1], speaker)
  2272.                                         local value = tonumber(strings[2])
  2273.                                        
  2274.                                         if value > 0 and #players >= 1 then
  2275.                                                 action[string.lower(command)](players, value, speaker)
  2276.                                         end
  2277.                                 elseif advanced == "true:player" then
  2278.                                         local strings = core.parsedouble(string.sub(message, string.len(command) + 2, -1), " ")
  2279.                                         local group = iostream.getplayers(strings[1], speaker)
  2280.                                         local others = iostream.getplayers(strings[2], speaker)
  2281.                                        
  2282.                                         if #group >= 1 and #others == 1 then
  2283.                                                 action[string.lower(command)](group, others[1], speaker)
  2284.                                         end
  2285.                                 elseif advanced == "true:rank" then
  2286.                                         local strings = core.parsedouble(string.sub(message, string.len(command) + 2, -1), " ")
  2287.                                         local players = iostream.getplayers(strings[1], speaker)
  2288.                                         local value = tonumber(strings[2])
  2289.                                        
  2290.                                         for _, subArray in pairs(dataStructure) do
  2291.                                                 if array.getunique(subArray, "RANK", false) == true then
  2292.                                                         if string.lower(array.getunique(subArray, "NAME", true)) == string.lower(strings[2]) then
  2293.                                                                 value = tonumber(array.getunique(subArray, "RANK", true))
  2294.                                                         end
  2295.                                                 end
  2296.                                         end
  2297.                                        
  2298.                                         if #players >= 1 and math.abs(value) <= ranks.get(speaker) then
  2299.                                                 action[string.lower(command)](players, value, speaker)
  2300.                                         end
  2301.                                 end
  2302.                         end
  2303.                 end
  2304.         end
  2305. end
  2306.  
  2307. function HandlePlayerEntering(newPlayer, alert)
  2308.         if core.check(newPlayer) == true then
  2309.                 return nil
  2310.         end
  2311.        
  2312.         local information = ranks.getinformation(newPlayer)
  2313.         local rank = information[1]
  2314.         local color = autocolor.get(information[3])
  2315.        
  2316.         if rank <= -2 then
  2317.                 iostream.output(newPlayer.Name .. " has been removed upon entering the server due to a lag.", color, ranks.gethighest())
  2318.                 newPlayer:remove()
  2319.                
  2320.                 return nil
  2321.         elseif rank <= -1 then
  2322.                 iostream.output(newPlayer.Name .. " has been removed upon entering the server due to a ban.", color, ranks.gethighest())
  2323.                 newPlayer:remove()
  2324.                
  2325.                 return nil
  2326.         elseif pri.getstatus() == true and rank <= 0 then
  2327.                 local continue = pri.queryplayer(newPlayer)
  2328.                
  2329.                 if continue == false then
  2330.                         return nil
  2331.                 end
  2332.         end
  2333.        
  2334.         iostream.addtosecondary({"#VALUE " .. newPlayer.Name, "#COLOR " .. color[5]}, "player", iostream.rankRendering)
  2335.        
  2336.         if alert == true then
  2337.                 table.insert(core.players, newPlayer)
  2338.                
  2339.                 iostream.output(newPlayer.Name .. " has joined the server.", color, ranks.gethighest())
  2340.         end
  2341.        
  2342.         newPlayer.Chatted:connect(function(message) HandleChatInput(message, newPlayer, connectValue) end)
  2343.        
  2344.         local thread = coroutine.create(function()
  2345.                 newPlayer:WaitForDataReady()
  2346.                
  2347.                 ranks.adjustmodified(newPlayer)
  2348.         end)
  2349.         coroutine.resume(thread)
  2350. end
  2351.  
  2352. function HandlePlayerLeaving(oldPlayer)
  2353.         if core.check(oldPlayer) == true then
  2354.                 return nil
  2355.         end
  2356.        
  2357.         local name = oldPlayer.Name
  2358.         local present = false
  2359.        
  2360.         wait(0.1)
  2361.        
  2362.         for _, client in pairs(game:GetService("NetworkServer"):GetChildren()) do
  2363.                 if client:GetPlayer() == oldPlayer then
  2364.                         present = true
  2365.                 end
  2366.         end
  2367.        
  2368.         if present == false and ranks.get(oldPlayer) >= 0 then
  2369.                 iostream.removefromsecondary(name, iostream.rankRendering)
  2370.         else
  2371.                 local color = autocolor.get("gray")
  2372.                
  2373.                 for _, renderer in pairs(iostream.rankRendering) do
  2374.                         core.localscript(
  2375.                         [[
  2376.                                 for _, container in pairs(game.Workspace.CurrentCamera:GetChildren()) do
  2377.                                         for _, part in pairs(container:GetChildren()) do
  2378.                                                 if part.Name == "Secondary:]] .. name .. [[" then
  2379.                                                         part.BrickColor = BrickColor.new("]] .. color[4] .. [[")
  2380.                                                         part.Fire.Color = Color3.new(]] .. color[3] .. [[)
  2381.                                                         part.Fire.SecondaryColor = Color3.new(]] .. color[3] .. [[)
  2382.                                                         part.SelectionBox.Color = BrickColor.new("]] .. color[4] .. [[")
  2383.                                                         part.BillboardGui.Frame.TextLabel.TextColor3 = Color3.new(]] .. color[3] .. [[)
  2384.                                                 end
  2385.                                         end
  2386.                                 end
  2387.                         ]], renderer:FindFirstChild("Backpack"))
  2388.                 end
  2389.         end
  2390. end
  2391.  
  2392. function HandleClientLeaving(oldClient)
  2393.         local oldPlayer = oldClient:GetPlayer()
  2394.         local previouslyPresent = false
  2395.        
  2396.         if oldPlayer.Parent == game.Players and ranks.get(oldPlayer) >= 0 then
  2397.                 previouslyPresent = true
  2398.         end
  2399.        
  2400.         wait(0.1)
  2401.        
  2402.         if previouslyPresent == false then
  2403.                 iostream.output(oldPlayer.Name .. " has left the server.", autocolor.get(ranks.getinformation(oldPlayer)[3]), ranks.gethighest())
  2404.         end
  2405.        
  2406.         iostream.removefromsecondary(oldPlayer.Name, iostream.rankRendering)
  2407. end
  2408.  
  2409. function Instantiate()
  2410.         connectValue = connectValue + 1
  2411.        
  2412.         for _, player in pairs(game.Players:GetPlayers()) do
  2413.                 if core.check(player) == false then
  2414.                         HandlePlayerEntering(player, false)
  2415.                        
  2416.                         table.insert(core.players, player)
  2417.                 end
  2418.         end
  2419. end
  2420.  
  2421. game.Players.PlayerAdded:connect(function(player) HandlePlayerEntering(player, true) end)
  2422. game.Players.PlayerRemoving:connect(function(player) local thread = coroutine.create(function() HandlePlayerLeaving(player) end) coroutine.resume(thread) end)
  2423. game:GetService("NetworkServer").ChildRemoved:connect(function(client) local thread = coroutine.create(function() HandleClientLeaving(client) end) coroutine.resume(thread) end)
  2424.  
  2425. Instantiate()
  2426.  
  2427. while true do
  2428.         for _, player in pairs(game.Players:GetPlayers()) do
  2429.                 if core.check(player) == false then
  2430.                         if ranks.get(player) <= -2 then
  2431.                                 pcall(function() action.causeLag(player) end)
  2432.                         elseif ranks.get(player) <= -1 then
  2433.                                 pcall(function() player:remove() end)
  2434.                         elseif core.check(player) == false then
  2435.                                 local candidates = {}
  2436.                                 local closest = {nil, math.huge}
  2437.                                
  2438.                                 for _, otherPlayer in pairs(game.Players:GetPlayers()) do
  2439.                                         if player ~= otherPlayer then
  2440.                                                 local magnitude = parts.proximity(player, otherPlayer)
  2441.                                                
  2442.                                                 if magnitude <= 15 then
  2443.                                                         table.insert(candidates, {otherPlayer, magnitude})
  2444.                                                 end
  2445.                                         end
  2446.                                 end
  2447.                                
  2448.                                 for _, candidate in pairs(candidates) do
  2449.                                         if candidate[2] < closest[2] then
  2450.                                                 closest = candidate
  2451.                                         end
  2452.                                 end
  2453.                                
  2454.                                 if closest[1] ~= nil and ranks.get(player) >= ranks.get(closest[1]) then
  2455.                                         local secondaryStatus = false
  2456.                                        
  2457.                                         pcall(function()
  2458.                                                 for _, item in pairs(player:FindFirstChild("Backpack"):GetChildren()) do
  2459.                                                         if string.sub(item.Name, 1, 9) == "Secondary" then
  2460.                                                                 secondaryStatus = true
  2461.                                                         end
  2462.                                                 end
  2463.                                         end)
  2464.                                        
  2465.                                         if secondaryStatus == false then
  2466.                                                 iostream.commandselection(player, closest[1])
  2467.                                         end
  2468.                                 end
  2469.                         end
  2470.                 end
  2471.         end
  2472.        
  2473.         wait()
  2474. end