mathmasterphil

Shock

Mar 4th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.62 KB | None | 0 0
  1. --.
  2.  
  3.  
  4.  
  5. script:Destroy()
  6. wait()
  7. do
  8. local player = game.Players.LocalPlayer
  9. function Spawn()
  10. local tool2 = game:GetService("InsertService"):LoadAsset(90718505):GetChildren()[1]
  11. tool2.Parent = player.Backpack
  12. tool2.ExponentialRocketLauncher:Remove()
  13. tool2.GunCursor:Remove()
  14. tool2.Name = "Shock Cannon"
  15. tool2.Handle.MotherRocket:Remove()
  16. local enabled = tool2.Enabled
  17. local mouse2
  18. local collided = false
  19. local ready = true
  20. local target
  21. local gui = Instance.new("BillboardGui",player.PlayerGui)
  22. gui.Size = UDim2.new(0,25,0,25)
  23. gui.AlwaysOnTop = true
  24. image = Instance.new("ImageLabel",gui)
  25. image.Size = gui.Size
  26. image.Image = "rbxasset://textures\\mouse2LockedCursor.png"
  27. image.BackgroundTransparency = 1
  28. function Shock(orb,charge)
  29. gui.Size = UDim2.new(0,0,0,0)
  30. target = nil
  31. neworb = orb:clone()
  32. orb:Remove()
  33. neworb.BodyVelocity:Remove()
  34. neworb.Anchored = true
  35. cf = neworb.CFrame
  36. neworb.Size = Vector3.new(charge/5,charge/5,charge/5)
  37. neworb.Material = "Plastic"
  38. neworb.Mesh:Remove()
  39. neworb.CFrame = cf
  40. neworb.Transparency = 1 - (charge/500)
  41. neworb.Touched:connect(function(hit)
  42. hum = hit.Parent:FindFirstChild("Humanoid")
  43. if hum --[[and hit.Name=="Torso"]] then
  44. tag = Instance.new("ObjectValue")
  45. tag.Name = "creator"
  46. tag.Value = player
  47. tag.Parent = hum
  48. hum:TakeDamage(charge*(hum.MaxHealth/500))
  49. end
  50. end)
  51. neworb.Parent = game.Workspace
  52. game.Debris:AddItem(neworb,1)
  53. for i=1,5 do
  54. for i=1,3 do
  55. p = Instance.new("Part",game.Workspace)
  56. p.FormFactor = "Custom"
  57. p.TopSurface = "Smooth"
  58. p.BottomSurface = "Smooth"
  59. p.BrickColor = neworb.BrickColor
  60. p.Size = Vector3.new(0.2,0.2,charge/30)
  61. p.Transparency = neworb.Transparency-0.25
  62. p.Anchored = true
  63. p.CanCollide = false
  64. p2 = p:clone()
  65. p2.Parent = game.Workspace
  66. p3 = p:clone()
  67. p3.Parent = game.Workspace
  68. p4 = p:clone()
  69. p4.Parent = game.Workspace
  70. p.CFrame = neworb.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-math.pi*20,math.pi*20)/10,math.random(-math.pi*20,math.pi*20)/10,math.random(-math.pi*20,math.pi*20)/10) * CFrame.new(0,0,charge/60)
  71. p2.CFrame = p.CFrame * CFrame.new(0,0,charge/60) * CFrame.fromEulerAnglesXYZ(math.random(-30,30)/10,math.random(-30,30)/10,math.random(-30,30)/10) * CFrame.new(0,0,charge/60)
  72. p3.CFrame = p2.CFrame * CFrame.new(0,0,charge/60) * CFrame.fromEulerAnglesXYZ(math.random(-30,30)/10,math.random(-30,30)/10,math.random(-30,30)/10) * CFrame.new(0,0,charge/60)
  73. p4.CFrame = p3.CFrame * CFrame.new(0,0,charge/60) * CFrame.fromEulerAnglesXYZ(math.random(-30,30)/10,math.random(-30,30)/10,math.random(-30,30)/10) * CFrame.new(0,0,charge/60)
  74. game.Debris:AddItem(p,0.2)
  75. game.Debris:AddItem(p2,0.2)
  76. game.Debris:AddItem(p3,0.2)
  77. game.Debris:AddItem(p4,0.2)
  78. end
  79. wait(0.2)
  80. end
  81. end
  82. function Launch(charge,orb,weld)
  83. weld:Remove()
  84. vel = Instance.new("BodyVelocity",orb)
  85. orb.CFrame = CFrame.new(orb.Position,orb.Position+tool2.Handle.CFrame.lookVector)
  86. orb.Parent = game.Workspace
  87. collided = false
  88. orb.Touched:connect(function(hit)
  89. if hit.Parent==tool2 or hit.Parent==tool2.Parent or hit.Parent:IsA("Hat") or hit.Name=="Handle" then
  90. return
  91. end
  92. collided = true
  93. Shock(orb,charge)
  94. orb:Remove()
  95. end)
  96. vel.velocity = CFrame.new(orb.Position,mouse2.Hit.p).lookVector * (charge * 1.5)
  97. game.Debris:AddItem(orb,30)
  98. wait()
  99. if target then
  100. waittime = charge/20
  101. timewaited = 0
  102. while true do
  103. if collided==true or orb.Parent==nil then
  104. break
  105. end
  106. timewaited = timewaited + 0.1
  107. if timewaited>=waittime then
  108. ready = true
  109. end
  110. part = game.Workspace:FindPartOnRay(Ray.new(orb.Position,target.Position),orb)
  111. if not part or part.Parent==target.Parent or part.Parent:FindFirstChild("Humanoid") then
  112. vel.velocity = CFrame.new(orb.Position,target.Position).lookVector * (charge * 1.5)
  113. end
  114. wait()
  115. end
  116. end
  117. end
  118. function Clicked()
  119. if ready==false then
  120. return
  121. end
  122. enabled = true
  123. ready = false
  124. orb = Instance.new("Part",tool2)
  125. orb.BrickColor = BrickColor.new("Bright yellow")
  126. orb.Shape = 0
  127. orb.Size = Vector3.new(1,1,1)
  128. orb.TopSurface = "Smooth"
  129. orb.BottomSurface = "Smooth"
  130. orb.CanCollide = false
  131. orb.Material = "Foil"
  132. orb.Name = "Ball"
  133. weld = Instance.new("Weld",orb)
  134. weld.Part0 = tool2.Handle
  135. weld.Part1 = orb
  136. weld.C0 = CFrame.new(0,0,-1.3)
  137. mesh = Instance.new("SpecialMesh",orb)
  138. mesh.MeshType = "Sphere"
  139. mesh.Scale = Vector3.new(0.01,0.01,0.01)
  140. charge = 0
  141. while true do
  142. if charge<100 then
  143. charge = charge + 1
  144. end
  145. mesh.Scale = Vector3.new(charge/100,charge/100,charge/100)
  146. weld.C0 = CFrame.new(0,0,-1.5-(charge/200)) * CFrame.fromEulerAnglesXYZ(math.random(-50,50)/10,math.random(-50,50)/10,math.random(-50,50)/10)
  147. p = Instance.new("Part",tool2)
  148. p.FormFactor = "Custom"
  149. p.TopSurface = "Smooth"
  150. p.BottomSurface = "Smooth"
  151. p.BrickColor = orb.BrickColor
  152. p.Size = Vector3.new(0.2,0.2,charge/60)
  153. p.Transparency = orb.Transparency-0.25
  154. p.Anchored = true
  155. p.CanCollide = false
  156. p.CFrame = orb.CFrame * CFrame.fromEulerAnglesXYZ(math.random(-math.pi*20,math.pi*20)/10,math.random(-math.pi*20,math.pi*20)/10,math.random(-math.pi*20,math.pi*20)/10) * CFrame.new(0,0,charge/120)
  157. pm = Instance.new("CylinderMesh",p)
  158. pm.Scale = Vector3.new(0.6,0.6,1)
  159. game.Debris:AddItem(p,0.1)
  160. if enabled==false then
  161. print(charge)
  162. Launch(charge,orb,weld)
  163. break
  164. end
  165. wait(0.01)
  166. end
  167. wait(charge/20)
  168. ready = true
  169. end
  170. function Released()
  171. enabled = false
  172. end
  173. function Moved()
  174. if target and target.Parent then
  175. if target.Parent.Humanoid.Health<=0 then
  176. target = nil
  177. end
  178. end
  179. if mouse2.Target and enabled==true then
  180. hum = mouse2.Target.Parent:FindFirstChild("Humanoid")
  181. torso = mouse2.Target.Parent:FindFirstChild("Torso")
  182. if hum and torso and hum.Health>0 then
  183. target = torso
  184. gui.Adornee = torso
  185. gui.Size = UDim2.new(0,25,0,25)
  186. gui.Parent = player.PlayerGui
  187. end
  188. end
  189. end
  190. function Equipped(m)
  191. enabled = false
  192. mouse2 = m
  193. mouse2.Button1Down:connect(Clicked)
  194. mouse2.Button1Up:connect(Released)
  195. mouse2.Move:connect(Moved)
  196. mouse2.Icon = "rbxasset://textures\\mouse2LockedCursor.png"
  197. end
  198. function Unequipped()
  199. gui:Remove()
  200. end
  201. tool2.Equipped:connect(Equipped)
  202. tool2.Unequipped:connect(Unequipped)
  203. end
  204. player.CharacterAdded:connect(Spawn)
  205. Spawn()
  206. end
Add Comment
Please, Sign In to add comment