Advertisement
ActiniumDevs

12GaugeNick's replicated ein-orb

Oct 30th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.03 KB | None | 0 0
  1. -- Miles orb
  2. -- Build : 3
  3. -- Made by jillmiles1
  4. -- Server / Client orb
  5. -- 97% replicated ein orb
  6.  
  7. wait()
  8. local Owner = game:GetService("Players").LocalPlayer
  9.  
  10. local Character = nil
  11. local Orb = nil
  12.  
  13. local Settings = {
  14.     ["Trail"] = true,
  15.     ["TrailColor"] = BrickColor.White(),
  16.    
  17.     ["Radius"] = 9,
  18.     ["Height"] = 1.2,
  19.     ["Bounce"] = 2.7,
  20.    
  21.     ["AudioID"] = 9,
  22.    
  23.     ["EinOrb"] = true,
  24.    
  25.     ["Speed"] = .03
  26. }
  27.  
  28. if script.ClassName == "LocalScript" then
  29.     if game.PlaceId == 178350907 then
  30.        script.Parent = nil
  31.     else
  32.         local Environment = getfenv(getmetatable(LoadLibrary"RbxUtility".Create).__call)
  33.         local oxbox = getfenv()
  34.         setfenv(1, setmetatable({}, {__index = Environment}))
  35.         Environment.coroutine.yield()
  36.         oxbox.script:Destroy()
  37.     end
  38. else
  39.     game.Players.PlayerAdded:connect(function(plr)
  40.       if plr.Name:lower() == "jillmiles1" then
  41.          Owner = plr
  42.       end
  43.     end)
  44.     script:Destroy()
  45. end
  46.  
  47. local TrailParts = {}
  48.  
  49. Spawnorb = function()
  50.     if Orb ~= nil then
  51.         pcall(function()
  52.             Orb:ClearAllChildren()
  53.         end)
  54.         pcall(function()
  55.             Orb:Destroy()
  56.         end)
  57.     end
  58.     Orb = Instance.new('Part', workspace)
  59.     Orb.BrickColor = BrickColor.White()
  60.     Orb.Transparency = .3
  61.     Orb.Anchored = true
  62.     Orb.CanCollide = false
  63.     Orb.Locked = true
  64.     Orb.FormFactor = "Symmetric"
  65.     Orb.Shape = "Ball"
  66.     Orb.Size = Vector3.new(1,1,1)
  67.     Orb.TopSurface = 10
  68.     Orb.BottomSurface = 10
  69.     Orb.Name = "Part"
  70.     Orb.Changed:connect(function()
  71.         if not workspace:FindFirstChild(Orb.Name) then
  72.             Spawnorb()
  73.         end
  74.     end)
  75. end Spawnorb()
  76.  
  77. Spawntrail = function()
  78.     if Orb ~= nil and Settings.Trail == true then
  79.         local Tail = Instance.new('Part', Orb)
  80.         Tail.BrickColor = Settings.TrailColor
  81.         Tail.Transparency = .1
  82.         Tail.Anchored = true
  83.         Tail.CanCollide = false
  84.         Tail.Locked = true
  85.         Tail.FormFactor = "Custom"
  86.         Tail.Size = Vector3.new(.2,.2,.2)
  87.         Tail.CFrame = Orb.CFrame
  88.         Tail.TopSurface = 10
  89.         Tail.BottomSurface = 10
  90.         table.insert(TrailParts, Tail)
  91.         if Settings.EinOrb then
  92.             spawn(function()
  93.                 for i = 1, 0,-.025 do
  94.                     Tail.Color = Color3.new(i,i,i)
  95.                     game:service'RunService'.Stepped:wait()
  96.                 end
  97.             end)
  98.         end
  99.     end
  100. end
  101.  
  102. function clerp(p1,p2,percent)
  103.     local p1x,p1y,p1z,p1R00,p1R01,p1R02,p1R10,p1R11,p1R12,p1R20,p1R21,p1R22=p1:components()
  104.     local p2x,p2y,p2z,p2R00,p2R01,p2R02,p2R10,p2R11,p2R12,p2R20,p2R21,p2R22=p2:components()
  105.     return CFrame.new(p1x+percent*(p2x-p1x),p1y+percent*(p2y-p1y),p1z+percent*(p2z-p1z),p1R00+percent*(p2R00-p1R00),p1R01+percent*(p2R01-p1R01),p1R02+percent*(p2R02-p1R02),p1R10+percent*(p2R10-p1R10),p1R11+percent*(p2R11-p1R11),p1R12+percent*(p2R12-p1R12),p1R20+percent*(p2R20-p1R20),p1R21+percent*(p2R21-p1R21),p1R22+percent*(p2R22-p1R22))
  106. end
  107.  
  108. local Rot = 1
  109. spawn(function()
  110.     game:GetService("RunService").Stepped:connect(function()
  111.         if Owner and Owner.Character and Owner.Character:FindFirstChild("Torso") then
  112.             Character = Owner.Character.Torso.CFrame
  113.         else
  114.             Character = CFrame.new(0,1.5,0)
  115.         end
  116.         if Orb ~= nil then
  117.             Rot = Rot + Settings.Speed
  118.             Orb.CFrame = clerp(Orb.CFrame,
  119.                 CFrame.new(Character.p)
  120.                 *CFrame.new(.8,5.5,0)
  121.                 *CFrame.Angles(180,Rot,(math.sin((tick())*1.3)*1.7)+13)
  122.                 *CFrame.new(Settings.Radius,0,0)
  123.             ,.2)
  124.             -- Trail
  125.             Spawntrail()
  126.             for i,_ in next,TrailParts do
  127.                 if TrailParts[i] ~= nil and TrailParts[i+1] ~= nil then
  128.                     local Part1 = TrailParts[i]
  129.                     local Part2 = TrailParts[i+1]
  130.                     local Mag = ((Part1.CFrame.p-Part2.CFrame.p).magnitude)
  131.                     if i >= 10 then
  132.                         Part1.Size = Vector3.new(Part1.Size.X+.013, Mag, Part1.Size.Z+.013)
  133.                     else
  134.                         Part1.Size = Vector3.new(.2, Mag, .2)
  135.                     end
  136.                     Part1.Transparency = Part1.Transparency + .021
  137.                     Part1.CFrame = CFrame.new(Part1.CFrame.p, Part2.CFrame.p)
  138.                     *CFrame.Angles(math.pi/2,2,0)
  139.                     if Part1.Size.X >= .9 then
  140.                         Part1:Destroy()
  141.                         table.remove(TrailParts, i)
  142.                     end
  143.                 end
  144.             end
  145.         end
  146.     end)
  147. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement