Advertisement
iiDeadzone

Orb

Jul 3rd, 2015
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.43 KB | None | 0 0
  1. wait()
  2. local Owner = game:GetService("Players").LocalPlayer
  3.  
  4. local Character = nil
  5. local Orb = nil
  6.  
  7. local Settings = {
  8.         ["Trail"] = true,
  9.         ["TrailColor"] = BrickColor.White(),
  10.        
  11.         ["Radius"] = 7,
  12.         ["Height"] = 1.2,
  13.         ["Bounce"] = 2.7,
  14.        
  15.     ["AudioID"] = 9,
  16.        
  17.         ["Sounds"] = {
  18.             163880175,
  19.             259816079,
  20.             152533464,
  21.             246448600,
  22.             160666496,
  23.             155076577,
  24.             257275814
  25.         },
  26.        
  27.         ["Speed"] = 88
  28. }
  29.  
  30. Owner.Chatted:connect(function(msg)
  31.     if msg:lower():sub(1,3) == "/e " then
  32.        msg = msg:sub(4)
  33.     end
  34.     if msg:lower():sub(1,6) == "speed " then
  35.        msg = tonumber(".0"..msg:sub(7))
  36.        Settings.Speed = tonumber(msg)
  37.     elseif msg:lower():sub(1,7) == "bounce " then
  38.        msg = tonumber(msg:sub(8))
  39.        Settings.Speed = tonumber(msg)
  40.     elseif msg:lower():sub(1,7) == "height " then
  41.        msg = tonumber(msg:sub(8))
  42.        Settings.Height = tonumber(msg)
  43.     elseif msg:lower():sub(1,5) == "trail" then
  44.         if Settings.Trail == true then
  45.             Settings.Trail = false
  46.         else
  47.             Settings.Trail = true
  48.         end
  49.     end
  50. end)
  51.  
  52. if script.ClassName == "LocalScript" then
  53.     if game.PlaceId == 178350907 then
  54.        script.Parent = nil
  55.     else
  56.         local Environment = getfenv(getmetatable(LoadLibrary"RbxUtility".Create).__call)
  57.         local oxbox = getfenv()
  58.         setfenv(1, setmetatable({}, {__index = Environment}))
  59.         Environment.coroutine.yield()
  60.         oxbox.script:Destroy()
  61.     end
  62. else
  63.     game.Players.PlayerAdded:connect(function(plr)
  64.       if plr.Name:lower() == "iiDeadzone" then
  65.          Owner = plr
  66.       end
  67.     end)
  68.     script:Destroy()
  69. end
  70.  
  71. local TrailParts = {}
  72.  
  73. Spawnorb = function()
  74.     Settings.AudioID = Settings.Sounds[math.random(1, #Settings.Sounds)]
  75.         if Orb ~= nil then
  76.                 pcall(function()
  77.                         Orb:ClearAllChildren()
  78.                 end)
  79.                 pcall(function()
  80.                         Orb:Destroy()
  81.                 end)
  82.         end
  83.         Orb = Instance.new('Part', workspace)
  84.         Orb.BrickColor = BrickColor.White()
  85.         Orb.Transparency = .1
  86.         Orb.Anchored = true
  87.         Orb.CanCollide = false
  88.         Orb.Locked = true
  89.         Orb.FormFactor = "Symmetric"
  90.         Orb.Shape = "Ball"
  91.         Orb.Size = Vector3.new(1,1,1)
  92.         Orb.TopSurface = 10
  93.         Orb.BottomSurface = 10
  94.         local Sound = Instance.new("Sound", Orb)
  95.         Sound.SoundId = "rbxassetid://"..Settings.AudioID
  96.         Sound.Volume = 1
  97.         Sound.Pitch = 1
  98.         Sound.Looped = true
  99.         wait()
  100.         Sound:Play()
  101.         Orb.Changed:connect(function()
  102.                 if not workspace:FindFirstChild(Orb.Name) then
  103.                         Spawnorb()
  104.                 end
  105.         end)
  106. end Spawnorb()
  107.  
  108. Spawntrail = function()
  109.         if Orb ~= nil and Settings.Trail == true then
  110.                 local Tail = Instance.new('Part', Orb)
  111.                 Tail.BrickColor = Settings.TrailColor
  112.                 Tail.Transparency = .1
  113.                 Tail.Anchored = true
  114.                 Tail.CanCollide = false
  115.                 Tail.Locked = true
  116.                 Tail.FormFactor = "Custom"
  117.                 Tail.Size = Vector3.new(.2,.2,.2)
  118.                 Tail.CFrame = Orb.CFrame
  119.                 Tail.TopSurface = 10
  120.                 Tail.BottomSurface = 10
  121.                 table.insert(TrailParts, Tail)
  122.                 spawn(function()
  123.                 for i=1, 0,-.064 do
  124.                 Tail.Color=Color3.new(i,i,i)
  125.                 game:service'RunService'.RenderStepped:wait()
  126.             end
  127.         end)
  128.         end
  129. end
  130.  
  131. function clerp(p1,p2,percent)
  132.     local p1x,p1y,p1z,p1R00,p1R01,p1R02,p1R10,p1R11,p1R12,p1R20,p1R21,p1R22=p1:components()
  133.     local p2x,p2y,p2z,p2R00,p2R01,p2R02,p2R10,p2R11,p2R12,p2R20,p2R21,p2R22=p2:components()
  134.     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))
  135. end
  136.  
  137. local Rot = 1
  138. spawn(function()
  139.         game:GetService("RunService").RenderStepped:connect(function()
  140.                 if Owner and Owner.Character and Owner.Character:FindFirstChild("Torso") then
  141.                     Character = Owner.Character.Torso.CFrame
  142.                 else
  143.                         Character = CFrame.new(0,1.5,0)
  144.                 end
  145.                 if Orb ~= nil then
  146.                         Rot = Rot + Settings.Speed
  147.                         Orb.Name = "MilesOrb_"..math.random(1,99999)
  148.                         Orb.CFrame = clerp(Orb.CFrame,
  149.                                 Character
  150.                                 *CFrame.new(0,3.7,0)
  151.                                 *CFrame.Angles(0,Rot,(math.sin((tick())*1.3)*2.7)+13)
  152.                                 *CFrame.new(Settings.Radius, math.sin((tick())*Settings.Bounce)*Settings.Height, 0)
  153.                                 *CFrame.Angles(math.sin(tick()),math.sin(tick()),math.sin(tick()))
  154.                         ,.1)
  155.                         -- Trail
  156.                         Spawntrail()
  157.                         for i,_ in next,TrailParts do
  158.                                 if TrailParts[i] ~= nil and TrailParts[i+1] ~= nil then
  159.                                         local Part1 = TrailParts[i]
  160.                                         local Part2 = TrailParts[i+1]
  161.                                         local Mag = ((Part1.CFrame.p-Part2.CFrame.p).magnitude)
  162.                                         Part1.Size = Vector3.new(Part1.Size.X+.016, Mag, Part1.Size.Z+.016)
  163.                                         Part1.Transparency = Part1.Transparency + .028
  164.                                         Part1.CFrame = CFrame.new(Part1.CFrame.p, Part2.CFrame.p)
  165.                                 * CFrame.Angles(math.pi/2,0,0)
  166.                                         if Part1.Size.X >= .64 then
  167.                                                 Part1:Destroy()
  168.                                                 table.remove(TrailParts, i)
  169.                                         end
  170.                                 end
  171.                         end
  172.                 end
  173.         end)
  174. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement