Advertisement
Guest User

device

a guest
Jun 17th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.84 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2. local DamageService = require(game.ServerScriptService.Modules.DamageService)
  3. local TargetService = require(game.ServerScriptService.Modules.TargetService)
  4. local TweenService = require(game.ServerScriptService.Modules.TweenService)
  5. local BezierCurves = require(game.ServerScriptService.Modules.BezierCurves)
  6.  
  7. local MoveRemotes = game.ReplicatedStorage:WaitForChild("MoveRemotes")
  8. local event = MoveRemotes["Robux Sucker 3000"]
  9.  
  10. local function setUpDevice(device)
  11.     local goal = {Value = device.Stage2:GetPrimaryPartCFrame() + Vector3.new(0,0.85,0)}
  12.     local properties = {Time = 0.5, Style = Enum.EasingStyle.Elastic, Dir = Enum.EasingDirection.Out}
  13.    
  14.     local CFrameValue = Instance.new("CFrameValue")
  15.     CFrameValue.Value = device.Stage2:GetPrimaryPartCFrame()
  16.    
  17.     local CFrameWatch = CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
  18.         device.Stage2:SetPrimaryPartCFrame(CFrameValue.Value)
  19.     end)
  20.    
  21.     local tween = TweenService.tween(CFrameValue, goal, properties)
  22.    
  23.     tween.Completed:Connect(function()
  24.         CFrameValue:Destroy()
  25.         CFrameWatch:Disconnect()
  26.        
  27.         device.Stage2.Light.Transparency = 0
  28.         device.Stage2.Light.Material = "Neon"
  29.         device.Stage2.Light.BrickColor = BrickColor.new("Lime green")
  30.     end)
  31. end
  32.  
  33. local function makeConnection(device, connections, character)
  34.     local status = true
  35.    
  36.     for i,v in pairs(connections) do
  37.         if v.address == character then
  38.             status = false
  39.         end
  40.     end
  41.    
  42.     if not status then return connections end
  43.    
  44.     local beam = game.ServerStorage.Storage.RobuxBeam:Clone()
  45.     beam.Name = character.Name
  46.     beam.Parent = device
  47.    
  48.     local newAttachment = Instance.new("Attachment")
  49.     newAttachment.Parent = character.HumanoidRootPart
  50.     newAttachment.Position = Vector3.new(0,0,0)
  51.     newAttachment.Name = "RobuxSiphon"
  52.    
  53.     beam.Attachment0 = newAttachment
  54.     beam.Attachment1 = device.Stage2.Light.Base
  55.    
  56.     connections[character.Name] = {beam, newAttachment, address = character}
  57.    
  58.     return connections
  59. end
  60.  
  61. local function explosion(device)
  62.     local explosion1 = game.ServerStorage.Storage.RobuxExplosionPart1:Clone()
  63.     local explosion2 = game.ServerStorage.Storage.RobuxExplosionPart2:Clone()
  64.     local particles = game.ServerStorage.Storage.RobuxExplosionParticles:Clone()
  65.    
  66.     local part = Instance.new("Part")
  67.     part.Size = Vector3.new(1,1,1)
  68.     part.Anchored = true
  69.     part.Transparency = 1
  70.     part.CanCollide = false
  71.     part.CFrame = CFrame.new(device.PrimaryPart.Position)
  72.     part.Parent = workspace
  73.    
  74.     game.Debris:AddItem(part, 1.5)
  75.    
  76.     particles.Parent = part
  77.    
  78.     explosion1.Parent = workspace
  79.     explosion2.Parent = workspace
  80.    
  81.     game.Debris:AddItem(explosion1, 1.5)
  82.     game.Debris:AddItem(explosion2, 1.5)
  83.    
  84.     explosion1.CFrame = CFrame.new(device.PrimaryPart.Position)
  85.     explosion2.CFrame = CFrame.new(device.PrimaryPart.Position)
  86.    
  87.     local goal = {Size = Vector3.new(30,30,30), Transparency = 1}
  88.     local properties = {Dir = Enum.EasingDirection.InOut, Style = Enum.EasingStyle.Back, Time = 1}
  89.    
  90.     TweenService.tween(explosion1, goal, properties)
  91.     TweenService.tween(explosion2, goal, properties)
  92.    
  93.     coroutine.resume(coroutine.create(function()
  94.         wait(0.75)
  95.         particles.Enabled = false
  96.     end))
  97.    
  98. end
  99.  
  100. event.OnServerEvent:Connect(function(player, details, pos)
  101.     local bezCurveVals = {i = 0, startPos = 0, control = 0, pos = 0, val = 0}
  102.     local active = false
  103.     local connections = {}
  104.        
  105.     local function bezCurve()
  106.         wait(0.01)
  107.         BezierCurves.Quadratic(bezCurveVals.i, bezCurveVals.startPos, bezCurveVals.control, bezCurveVals.pos, bezCurveVals.val, "Value", CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(-90), 0))
  108.         bezCurveVals.val.Value = bezCurveVals.val.Value
  109.         bezCurveVals.i = bezCurveVals.i + 5
  110.     end
  111.                                
  112.     local device = game.ServerStorage.Storage["Robux Device"]:Clone()
  113.     device.Parent = workspace
  114.     device:SetPrimaryPartCFrame(player.Character.LeftHand.CFrame)
  115.    
  116.     local weld = Instance.new("Weld")
  117.     weld.Parent = player.Character.LeftHand
  118.     weld.Part0 = weld.Parent
  119.     weld.Part1 = device.PrimaryPart
  120.    
  121.     local animation = Instance.new("Animation")
  122.     animation.AnimationId = "http://www.roblox.com/Asset?ID="..details.animations.main
  123.    
  124.     local track = player.Character.Humanoid:LoadAnimation(animation)
  125.     track:Play()
  126.    
  127.     track.KeyframeReached:Connect(function(keyframe)
  128.         if keyframe == "Throw" then
  129.             weld:Destroy()
  130.            
  131.             for i,v in pairs(device:GetDescendants()) do
  132.                 if v:IsA("BasePart") then
  133.                     v.Anchored = true
  134.                 end
  135.             end
  136.            
  137.             local startPos = device.PrimaryPart.CFrame
  138.        
  139.             local midpoint = (device.PrimaryPart.Position + pos)/2
  140.             local control = CFrame.new(midpoint) * CFrame.new(0,10,0)
  141.            
  142.             local CFrameValue = Instance.new("CFrameValue")
  143.             CFrameValue.Parent = device
  144.             CFrameValue.Value = device:GetPrimaryPartCFrame()
  145.            
  146.             local CFrameWatch = CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
  147.                 device:SetPrimaryPartCFrame(CFrameValue.Value)
  148.             end)
  149.            
  150.             bezCurveVals.i = 0
  151.             bezCurveVals.startPos = startPos
  152.             bezCurveVals.control = control
  153.             bezCurveVals.pos = CFrame.new(pos)
  154.             bezCurveVals.val = CFrameValue
  155.            
  156.             local onHeart = RunService.Heartbeat:Connect(bezCurve)
  157.        
  158.             repeat wait() until bezCurveVals.i >= 100
  159.             active = true
  160.             device:SetPrimaryPartCFrame(device.PrimaryPart.CFrame + Vector3.new(0,-1,0))
  161.            
  162.             setUpDevice(device)
  163.            
  164.             onHeart:Disconnect()
  165.             CFrameWatch:Disconnect()
  166.         end
  167.     end)
  168.    
  169.     repeat wait() until active
  170.    
  171.     game.Debris:AddItem(device, details.duration+1.5)
  172.    
  173.     coroutine.resume(coroutine.create(function()
  174.         wait(details.duration)
  175.         active = false
  176.         for i,v in pairs(device:GetDescendants()) do
  177.             if v:IsA("BasePart") then
  178.                 local goal = {Transparency = 1}
  179.                 local properties = {Dir = Enum.EasingDirection.Out, Style = Enum.EasingStyle.Sine, Time = 1.5}
  180.                
  181.                 TweenService.tween(v, goal, properties)
  182.             end
  183.         end
  184.     end))
  185.    
  186.     local healAmount = 0
  187.    
  188.     while active do
  189.         local targets = TargetService.findMagNpc(player, device.PrimaryPart, details.mag, details.targets)
  190.        
  191.         for i,v in pairs(targets) do
  192.             connections = makeConnection(device, connections, v)
  193.         end
  194.        
  195.         for i,v in pairs(connections) do
  196.             local status = false
  197.            
  198.             for j,k in pairs(targets) do
  199.                 if k == v.address then
  200.                     status = true
  201.                 end
  202.             end
  203.            
  204.             if not status then
  205.                 for n,m in pairs(v) do
  206.                     m:Destroy()
  207.                 end
  208.                
  209.                 connections[i] = nil
  210.             end
  211.         end
  212.        
  213.         if #targets > 0 then
  214.             DamageService.npcDamage(player, targets, details)
  215.         end
  216.        
  217.         for i,v in pairs(targets) do
  218.             healAmount = healAmount + details.dmg * details.steal
  219.         end
  220.        
  221.         wait(0.5)
  222.     end
  223.    
  224.     explosion(device)
  225.    
  226.     wait(0.2)
  227.    
  228.     local healTargets = TargetService.findMagAllies(player, device.PrimaryPart, 30, details.targets)
  229.    
  230.     details.heal = healAmount
  231.    
  232.     if #healTargets > 0 then
  233.         DamageService.playerHeal(player, healTargets, details)
  234.     end
  235.  
  236. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement