Guest User

Code

a guest
Mar 20th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.06 KB | None | 0 0
  1. -- LocalScript for Launcher
  2.  
  3.  
  4.  
  5. local tool = script.Parent
  6. local handle = tool:WaitForChild("Handle")
  7. local player = game.Players.LocalPlayer
  8. local mouse = player:GetMouse()
  9. local humanoid = player.Character:FindFirstChild("Humanoid")
  10.  
  11. local debounce = true
  12.  
  13. tool.Activated:connect(function()
  14.     if debounce then
  15.         if humanoid.Health > 0 then
  16.             debounce = false
  17.            
  18.             local rocket = Instance.new("Part",game.Workspace)
  19.             rocket.Position = handle.Position
  20.             rocket.CanCollide = true
  21.             rocket.TopSurface = "Smooth"
  22.             rocket.BottomSurface = "Smooth"
  23.             rocket.Size = Vector3.new(1,1,1)
  24.             rocket.CFrame = handle.CFrame
  25.             rocket.CFrame = CFrame.new(rocket.Position,mouse.Hit.p)
  26.        
  27.             rocket.Touched:connect(function(hit)
  28.                 if hit.Name == "Part" then
  29.                     local explosion = Instance.new('Explosion')
  30.                     --[[explosion.Parent = game.Workspace
  31.                     explosion.Position = rocket.Position
  32.                     explosion.BlastPressure = 1
  33.                     explosion.BlastRadius = 2
  34.                     explosion.Visible = true
  35.                     --]]explosion.DestroyJointRadiusPercent = 0.2
  36.                     local model = hit.Parent
  37.                     for _, part in next, model:GetChildren() do
  38.                         if part.Name == "Part" and (part.Position - hit.Position).magnitude <= 5 then
  39.                             local weld = part:FindFirstChild('Weld')
  40.                             if weld then weld:Destroy() end
  41.                         end
  42.                     end
  43.                     rocket:Destroy()
  44.                 end
  45.             end)
  46.    
  47.             local speed = Instance.new("BodyVelocity", rocket)
  48.             speed.Velocity = rocket.CFrame.lookVector *90
  49.             speed.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  50.            
  51.             wait(1)
  52.            
  53.             debounce = true        
  54.         end
  55.     end
  56. end)
  57.  
  58.  
  59.  
  60.  
  61. -- Script for Block
  62.  
  63.  
  64. local parts = script.Parent:GetChildren()
  65. local lastPart
  66.  
  67. for i = 1, #parts do
  68.     if parts[i]:IsA('BasePart') then
  69.         if lastPart then
  70.             local weld = Instance.new('Weld')
  71.             weld.Part0 = parts[i]
  72.             weld.Part1 = lastPart
  73.             weld.C0 = parts[i].CFrame:inverse()
  74.             weld.C1 = lastPart.CFrame:inverse()
  75.             weld.Parent = parts[i]
  76.         end
  77.         lastPart = parts[i]
  78.     end
  79. end
Advertisement
Add Comment
Please, Sign In to add comment