Advertisement
DropSquad

Orb [OPEN-SOURCE]

Aug 12th, 2015
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.26 KB | None | 0 0
  1. --[[ OPEN-SOURCE COMPANION ]]--
  2.  
  3. local Main = {
  4.     Settings = {
  5.         Radius = 10,
  6.     },
  7.     Classes = {
  8.         _CREATOR = game.Players.LocalPlayer.Name,
  9.         _ORB = {
  10.             Name = "Orb",
  11.             Material = "Neon",
  12.         }
  13.     },
  14.     Schemes = {},
  15.     Commands = {Prefix = "/"},
  16.     Connections = {},
  17. }
  18.  
  19. function Main.new(_CLASS)
  20.     local Returned do
  21.         if _CLASS == "_ORB" then
  22.             Returned = Instance.new("Part", game.Players.LocalPlayer.Character) do
  23.                 Returned.Name = Main.Classes[_CLASS].Name
  24.                 Returned.FormFactor = "Custom"
  25.                 Returned.Size = Vector3.new(1.4, 1.4, 1.4)
  26.                 Returned.TopSurface = "Smooth"
  27.                 Returned.BottomSurface = "Smooth"
  28.                 Returned.Anchored = true
  29.                 Returned.CanCollide = false
  30.                 Returned.Material = Main.Classes[_CLASS].Material
  31.                 Instance.new("SpecialMesh", Returned).MeshType = "Sphere"
  32.             end
  33.         end
  34.     end
  35.     return Returned
  36. end
  37.  
  38. function Main:AddScheme(Name, Scheme)
  39.     local Name = string.lower(Name)
  40.     if not self.Schemes[Name] then
  41.         self.Schemes[Name] = Scheme
  42.     end
  43.     return self.Schemes[Name]
  44. end
  45.  
  46. function Main:AddCommand(Name, Function)
  47.     local Name = string.lower(Name)
  48.     if not self.Commands[Name] then
  49.         self.Commands[Name] = Function
  50.     end
  51. end
  52.  
  53. function Main:GenerateParticle(Index)
  54.     local InitialSize = Vector3.new(0.7, 0.7, 0.7)
  55.     local FinalSize = InitialSize * 10
  56.     local Color = self.Schemes.Current[math.floor(math.deg(Index)) % #self.Schemes.Current + 1]
  57.     local Particle = Instance.new("Part", self.Orb)
  58.     Particle.Material = self.Orb.Material
  59.     Particle.BrickColor = Color
  60.     Particle.Anchored = true
  61.     Particle.CanCollide = false
  62.     Particle.FormFactor = "Custom"
  63.     Particle.TopSurface = "Smooth"
  64.     Particle.BottomSurface = "Smooth"
  65.     Particle.Size = InitialSize
  66.     Particle.CFrame = self.Orb.CFrame
  67.     Instance.new("SpecialMesh", Particle).MeshType = "Sphere"
  68.     spawn(function()
  69.         for Alpha = 0, 1, 1/30 do
  70.             wait()
  71.             Particle.Transparency = Alpha
  72.             Particle.Size = InitialSize:Lerp(FinalSize, Alpha^4)
  73.         end
  74.         Particle:Destroy()
  75.     end)
  76. end
  77.  
  78. function Main:BindOrbit(Key)
  79.     self.Connections[Key] = true
  80.     local Index = 0
  81.     while self.Connections[Key] do
  82.         wait()
  83.         Index = Index + math.rad(5)
  84.         if not self.Orb then
  85.             self.Orb = self.new("_ORB")
  86.         end
  87.         self.Orb.CFrame = self.Orb.CFrame:lerp(game.Players.LocalPlayer.Character.Head.CFrame
  88.         * CFrame.Angles(math.sin(tick())/4, math.sin(tick())/4, math.sin(tick())/4)
  89.         * CFrame.new(self.Settings.Radius*math.sin(Index), 0, self.Settings.Radius*math.cos(Index)), 0.075)
  90.         self.Orb.BrickColor = self.Schemes.Current.OrbColor
  91.         self:GenerateParticle(Index)
  92.     end
  93. end
  94.  
  95. function Main:UnbindOrbit(Key)
  96.     self.Connections[Key] = false
  97. end
  98.  
  99. game.Players.LocalPlayer.Chatted:connect(function(Message)
  100.     if string.match(Message, "^" .. Main.Commands.Prefix) then
  101.         local Command = string.match(Message, "%w+")
  102.         if Command and Main.Commands[string.lower(Command)] then
  103.             local _, StringEnd = string.find(Message, Command)
  104.             Main.Commands[string.lower(Command)](string.sub(Message, StringEnd + 2))
  105.         end
  106.     end
  107. end)
  108.  
  109. do
  110.     Main.Orb = Main.new("_ORB")
  111. end
  112.  
  113. do
  114.     Main.Schemes.Current = Main:AddScheme("Frostbite", {
  115.         BrickColor.Blue(),
  116.         OrbColor = BrickColor.new("Pastel blue"),
  117.     })
  118. end
  119.  
  120. do
  121.     Main:AddCommand("Output", function(Message)
  122.         print(Message)
  123.     end)
  124. end
  125.  
  126. Main:BindOrbit("_ORB-Bind")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement