Advertisement
mathmasterphil

ChainGun

Mar 7th, 2015
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.01 KB | None | 0 0
  1. local Me = game.Players.LocalPlayer
  2. local char = Me.Character
  3. local pg = Me:findFirstChild("PlayerGui")
  4.  
  5. local sc = Instance.new("ScreenGui")
  6. sc.Name = "unHide"
  7. local tx = Instance.new("TextLabel")
  8. tx.BackgroundTransparency = 0.3
  9. tx.Name = "Ammo Chart"
  10. tx.Parent = sc
  11. tx.Position = UDim2.new(0, 0, 0, 500)
  12. tx.Size = UDim2.new(0, 100, 0, 25)
  13. tx.Text = "Ammo: "
  14.  
  15. local on = false
  16. local ammo = 500
  17.  
  18. local newweld = Instance.new("Weld")
  19. newweld.Parent = char.Torso
  20. newweld.Part0 = char.Torso
  21. newweld.Part1 = char["Right Arm"]
  22. newweld.C0 = CFrame.new(1.5,0,-0.5)*CFrame.Angles(math.rad(45),math.rad(5),0)
  23. local newweld1 = Instance.new("Weld")
  24. newweld1.Parent = char.Torso
  25. newweld1.Part0 = char.Torso
  26. newweld1.Part1 = char["Left Arm"]
  27. newweld1.C0 = CFrame.new(-0.5,0,-1)*CFrame.Angles(math.rad(60),math.rad(10),0.5)
  28. chain1 = Instance.new("Part")
  29. chain1.Parent = char
  30. chain1.formFactor = "Custom"
  31. chain1.Size = Vector3.new(3,3,2)  -- this works? :o
  32. chain1.BrickColor = BrickColor.new("Black")
  33. chain1:BreakJoints()
  34. mesh = Instance.new("SpecialMesh")
  35. mesh.Parent = chain1
  36. mesh.MeshType = 'FileMesh'
  37. mesh.MeshId = "http://www.roblox.com/asset/?id=2806162"
  38. mesh.Scale = Vector3.new(1.5,1.5,1)
  39. weld = Instance.new("Weld")
  40. weld.Parent = chain1
  41. weld.Part0 = char["Right Arm"]
  42. weld.Part1 = chain1
  43. weld.C0 = CFrame.new(-0.5, -1, 0) * CFrame.Angles(-0.4, 0.8, 0)
  44. chain1.CanCollide = true
  45. -------
  46. chain2 = Instance.new("Part")
  47. chain2.Parent = char
  48. chain2.Transparency = 1
  49. chain2.formFactor = "Custom"
  50. chain2.Size = Vector3.new(1,1,1)  -- this works? :o
  51. chain2.BrickColor = BrickColor.new("Black")
  52. chain2:BreakJoints()
  53. weld2 = Instance.new("Weld")
  54. weld2.Parent = chain2
  55. weld2.Part0 = chain1
  56. weld2.Part1 = chain2
  57. weld2.C0 = CFrame.new(0.25, -0.5, -2.5) * CFrame.Angles(0, 0, 0)
  58. chain2.CanCollide = false
  59. -------
  60. grip1 = Instance.new("Part")
  61. grip1.Parent = char
  62. grip1.formFactor = "Custom"
  63. grip1.Size = Vector3.new(3,3,2)  -- this works? :o
  64. grip1.BrickColor = BrickColor.new("Black")
  65. grip1:BreakJoints()
  66. mesh = Instance.new("SpecialMesh")
  67. mesh.Parent = grip1
  68. mesh.MeshType = 'FileMesh'
  69. mesh.MeshId = "http://www.roblox.com/asset/?id=3270017"
  70. mesh.Scale = Vector3.new(1,1,1)
  71. weld = Instance.new("Weld")
  72. weld.Parent = grip1
  73. weld.Part0 = char["Left Arm"]
  74. weld.Part1 = grip1
  75. weld.C0 = CFrame.new(0, -1, 0) * CFrame.Angles(-0.4, 0.8, 0)
  76. grip1.CanCollide = true
  77.  
  78. local decoy = Instance.new("Model", char)
  79. decoy.Name = "DECOY"
  80. local decoy2 = Instance.new("Model", decoy)
  81. decoy2.Name = "DECOY"
  82. local decoy3 = Instance.new("Model", decoy2)
  83. decoy3.Name = "DECOY"
  84. local decoy4 = Instance.new("Model", decoy3)
  85. decoy4.Name = "DECOY"
  86. local decoy5 = Instance.new("Model", decoy4)
  87. decoy5.Name = "DECOY"
  88. local decoy6 = Instance.new("Model", decoy5)
  89. decoy6.Name = "DECOY"
  90. local decoy7 = Instance.new("Model", decoy6)
  91. decoy7.Name = "DECOY"
  92. local decoy8 = Instance.new("Model", decoy7)
  93. decoy8.Name = "DECOY"
  94. local decoy9 = Instance.new("Model", decoy8)
  95. decoy9.Name = "DECOY"
  96.  
  97. local parta = Instance.new("Part")
  98. parta.Parent = decoy9
  99. parta.Anchored = true
  100. parta.Name = "Ammo"
  101. parta.CanCollide = false
  102. parta.Transparency = 0
  103. parta.formFactor = "Custom"
  104. parta.Size = Vector3.new(4, 4, 4)
  105. parta.BrickColor = BrickColor.new("Bright green")
  106. parta.CFrame = CFrame.new(math.random(-45, 45), 2, math.random(-45, 45))
  107.  
  108. if script.Parent.className ~= "HopperBin" then
  109.     local h = Instance.new("HopperBin", Me.Backpack)
  110.     h.Name = "ChainGun"
  111.     script.Parent = h
  112. end
  113.  
  114. local bin = script.Parent
  115.  
  116. function onSelected(mouse)
  117. sc.Parent = pg
  118. tx.Text = "Ammo: " ..ammo.. "!"
  119.     mouse.Button1Down:connect(function()
  120.     on = true
  121.     for i = 0, 1, 0.1 do
  122.     newweld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,math.rad(3.5*i))
  123.     newweld1.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,math.rad(3.5*i))
  124.     wait()
  125.     end
  126. wait(1)
  127. for i = 1, 100 do
  128. if on == true and ammo > 0 then
  129. ammo = ammo - 1
  130. tx.Text = "Ammo: " ..ammo.. "!"
  131. local P = Instance.new("Part")
  132. local M = Instance.new("BlockMesh")
  133. local Place0 = chain2.CFrame
  134. local Place1 = mouse.Hit.p
  135. P.formFactor = 0
  136. P.Size = Vector3.new(1,1,(Place0.p - Place1).magnitude)
  137. P.Name = "Laser"
  138. P.CFrame = CFrame.new((Place0.p + Place1)/2,Place0.p)
  139. P.Parent = char
  140. P.BrickColor = BrickColor.Yellow()
  141. P.Anchored = true
  142. P.CanCollide = false
  143. M.Scale = Vector3.new(0.2,0.2,1)
  144. M.Bevel = 0.11
  145. M.Parent = P
  146. for i = 1,5 do
  147. P2 = P:Clone()
  148. P2.Size = Vector3.new(1,1,10)
  149. P2.Parent = P
  150. P2.CFrame = CFrame.new(Place1.x,Place1.y,Place1.z) * CFrame.fromEulerAnglesXYZ(math.random(1,100),math.random(1,100),math.random(1,100))
  151. end
  152. mouse.Target:BreakJoints()
  153. if mouse.Target.Name ~= "Base" then
  154. mouse.Target.Anchored = false
  155. end
  156. if mouse.Target.Parent:findFirstChild("Humanoid") ~= nil then
  157. mouse.Target.Parent:BreakJoints()
  158. end
  159. if mouse.Target.Parent.Parent:findFirstChild("Humanoid") ~= nil then
  160. mouse.Target.Parent.Parent:BreakJoints()
  161. end
  162. if mouse.Target.Parent.Parent:findFirstChild("Humanoid") ~= nil then
  163. mouse.Target.Parent.Parent:BreakJoints()
  164. end
  165. wait()
  166. pcall(function() P:remove() end)
  167. end
  168. end
  169.     end)
  170.     mouse.Button1Up:connect(function()
  171.     on = false
  172.     for i = 0, 1, 0.1 do
  173.     newweld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,math.rad(-3.5*i))
  174.     newweld1.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,math.rad(-3.5*i))
  175.     wait()
  176.     end
  177.     end)
  178.     mouse.KeyDown:connect(function(key)
  179.         if key == "q" then
  180.         print('down')
  181.     def = true
  182.     for i = 0, 1, 0.1 do
  183.     newweld.C1 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(-25*i),math.rad(0*i),0)
  184.     newweld1.C1 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(-25*i),math.rad(0*i),0)
  185.     wait()
  186.     end
  187. local bv = Instance.new("BodyAngularVelocity")
  188. bv.Parent = char.Torso
  189. bv.Name = "Chainbv"
  190. bv.angularvelocity = Vector3.new(0, 35, 0)
  191. bv.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  192. local bg = Instance.new("BodyGyro")
  193. bg.Parent = char.Torso
  194. bg.Name = "Chainbg"
  195. bg.maxTorque = Vector3.new(1000, 1000, 1000)
  196. for i = 1, 9999999 do
  197. if def == true then
  198. for _, v in pairs(game.Players:GetChildren()) do
  199. if (v.Character.Torso.Position - chain1.Position).magnitude < 4 then
  200. if v.Character.Name ~= char.Name then
  201. v.Character.Humanoid:TakeDamage(5)
  202. end
  203. end
  204. end
  205. end
  206. wait()
  207. end  
  208.     end
  209.     end)
  210.     mouse.KeyUp:connect(function(key)
  211.         if key == "q" then
  212.         print('up')
  213.     def = false
  214. pcall(function() char.Torso.Chainbv:remove() end)
  215. pcall(function() char.Torso.Chainbg:remove() end)
  216.     for i = 0, 1, 0.1 do
  217.     newweld.C1 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(-25+25*i),math.rad(0*i),0)
  218.     newweld1.C1 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(-25+25*i),math.rad(0*i),0)
  219.     wait()
  220.     end
  221.     end
  222.     end)
  223. end
  224.  
  225. function onDesel(mouse)
  226. sc.Parent = nil
  227. end
  228.  
  229. bin.Selected:connect(onSelected)
  230. bin.Deselected:connect(onDesel)
  231.  
  232. while bin.Selected do
  233. if ammo < 500 and (char.Torso.Position - parta.Position).magnitude < 2 then
  234. dif = 500 - ammo
  235. ammo = ammo + dif
  236. tx.Text = "Ammo: " ..ammo.. "!"
  237. end
  238. wait()
  239. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement