codemen

Mini shotgun script [roblox]

Nov 11th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.10 KB | None | 0 0
  1. Player = game.Players.LocalPlayer
  2. Character = Player.Character
  3. script.Parent = Character
  4.  
  5. --[[ * Fire Handle * ]]--
  6.  
  7. pcall(function() Character.Gun:Remove() end)
  8.  
  9. Gun = Instance.new("Model")
  10. Gun.Name = "Gun"
  11. Gun.Parent = Character
  12.  
  13. --[[ * Arm Weld * ]]--
  14.  
  15. ArmWeld = Instance.new("Weld")
  16. ArmWeld.Parent = Character["Torso"]
  17. ArmWeld.Part0 = ArmWeld.Parent
  18. ArmWeld.Part1 = Character["Right Arm"]
  19. ArmWeld.C0 = CFrame.new(1.5,0.5,-0.5) * CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)
  20.  
  21. --[[ * Arm Weld * ]]--
  22.  
  23. ArmWeldR = Instance.new("Weld")
  24. ArmWeldR.Parent = Character["Torso"]
  25. ArmWeldR.Part0 = ArmWeldR.Parent
  26. ArmWeldR.Part1 = Character["Left Arm"]
  27. ArmWeldR.C0 = CFrame.new(-1.5,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  28.  
  29. --[[ * Neck Weld * ]]--
  30.  
  31. Neck = Instance.new("Weld")
  32. Neck.Parent = Character["Torso"]
  33. Neck.Part0 = Neck.Parent
  34. Neck.Part1 = Character["Head"]
  35. Neck.C0 = CFrame.new(0,1.5,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  36.  
  37. --[[ * Handle * ]]--
  38.  
  39. Handle = Instance.new("Part")
  40. Handle.formFactor = "Custom"
  41. Handle.Locked = true
  42. Handle.CanCollide = false
  43. Handle.BrickColor = BrickColor.new("Medium stone grey")
  44. Handle.Anchored = false
  45. Handle.Size = Vector3.new(0.25,0.7,0.25)
  46. Handle.TopSurface = 0
  47. Handle.BottomSurface = 0
  48. Handle.Parent = Gun
  49. MeshA = Instance.new("BlockMesh",Handle)
  50. WeldA = Instance.new("Weld")
  51. WeldA.Parent = Handle
  52. WeldA.Part0 = Character["Right Arm"]
  53. WeldA.Part1 = Handle
  54. WeldA.C0 = CFrame.new(0,-1.1,-0.2) * CFrame.Angles(-math.pi/2-0.1,0,0)
  55.  
  56. --[[ * Cartrage * ]]--
  57.  
  58. Cartrage = Instance.new("Part")
  59. Cartrage.formFactor = "Custom"
  60. Cartrage.Locked = true
  61. Cartrage.CanCollide = false
  62. Cartrage.BrickColor = BrickColor.new("Really black")
  63. Cartrage.Anchored = false
  64. Cartrage.Size = Vector3.new(0.2,0.5,0.2)
  65. Cartrage.TopSurface = 0
  66. Cartrage.BottomSurface = 0
  67. Cartrage.Parent = Gun
  68. MeshB = Instance.new("BlockMesh",Cartrage)
  69. WeldB = Instance.new("Weld")
  70. WeldB.Parent = Cartrage
  71. WeldB.Part0 = Handle
  72. WeldB.Part1 = Cartrage
  73. WeldB.C0 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0)
  74.  
  75. --[[ * Trigger * ]]--
  76.  
  77. Trigger = Instance.new("Part")
  78. Trigger.formFactor = "Custom"
  79. Trigger.Locked = true
  80. Trigger.CanCollide = false
  81. Trigger.BrickColor = BrickColor.new("Really black")
  82. Trigger.Anchored = false
  83. Trigger.Size = Vector3.new(0.2,0.4,0.4)
  84. Trigger.TopSurface = 0
  85. Trigger.BottomSurface = 0
  86. Trigger.Parent = Gun
  87. MeshB = Instance.new("BlockMesh",Trigger)
  88. WeldB = Instance.new("Weld")
  89. WeldB.Parent = Trigger
  90. WeldB.Part0 = Handle
  91. WeldB.Part1 = Trigger
  92. WeldB.C0 = CFrame.new(0,0.21,-0.09) * CFrame.Angles(0,0,0)
  93.  
  94. --[[ * BWall * ]]--
  95.  
  96. BWall = Instance.new("Part")
  97. BWall.formFactor = "Custom"
  98. BWall.Locked = true
  99. BWall.CanCollide = false
  100. BWall.BrickColor = BrickColor.new("Medium stone grey")
  101. BWall.Anchored = false
  102. BWall.Size = Vector3.new(0.25,0.6,0.25)
  103. BWall.TopSurface = 0
  104. BWall.BottomSurface = 0
  105. BWall.Parent = Gun
  106. MeshB = Instance.new("BlockMesh",BWall)
  107. WeldB = Instance.new("Weld")
  108. WeldB.Parent = BWall
  109. WeldB.Part0 = Handle
  110. WeldB.Part1 = BWall
  111. WeldB.C0 = CFrame.new(0,0.3,-0.3) * CFrame.Angles(math.pi/2+0.1,0,0)
  112.  
  113. --[[ * CWall * ]]--
  114.  
  115. CWall = Instance.new("Part")
  116. CWall.formFactor = "Custom"
  117. CWall.Locked = true
  118. CWall.CanCollide = false
  119. CWall.BrickColor = BrickColor.new("Really black")
  120. CWall.Anchored = false
  121. CWall.Size = Vector3.new(0.3,0.6,0.2)
  122. CWall.TopSurface = 0
  123. CWall.BottomSurface = 0
  124. CWall.Parent = Gun
  125. MeshB = Instance.new("BlockMesh",CWall)
  126. WeldB = Instance.new("Weld")
  127. WeldB.Parent = CWall
  128. WeldB.Part0 = Handle
  129. WeldB.Part1 = CWall
  130. WeldB.C0 = CFrame.new(0,0.4,-0.3) * CFrame.Angles(math.pi/2+0.1,0,0)
  131.  
  132. --[[ * ButA * ]]--
  133.  
  134. ButA = Instance.new("Part")
  135. ButA.formFactor = "Custom"
  136. ButA.Locked = true
  137. ButA.CanCollide = false
  138. ButA.BrickColor = BrickColor.new("Really black")
  139. ButA.Anchored = false
  140. ButA.Size = Vector3.new(0.3,0.6,0.3)
  141. ButA.TopSurface = 0
  142. ButA.BottomSurface = 0
  143. ButA.Parent = Gun
  144. MeshB = Instance.new("CylinderMesh",ButA)
  145. WeldB = Instance.new("Weld")
  146. WeldB.Parent = ButA
  147. WeldB.Part0 = Handle
  148. WeldB.Part1 = ButA
  149. WeldB.C0 = CFrame.new(0.1,0.4,-0.3) * CFrame.Angles(math.pi/2+0.1,0,0)
  150.  
  151. --[[ * ButB * ]]--
  152.  
  153. ButB = Instance.new("Part")
  154. ButB.formFactor = "Custom"
  155. ButB.Locked = true
  156. ButB.CanCollide = false
  157. ButB.BrickColor = BrickColor.new("Really black")
  158. ButB.Anchored = false
  159. ButB.Size = Vector3.new(0.3,0.6,0.3)
  160. ButB.TopSurface = 0
  161. ButB.BottomSurface = 0
  162. ButB.Parent = Gun
  163. MeshB = Instance.new("CylinderMesh",ButB)
  164. WeldB = Instance.new("Weld")
  165. WeldB.Parent = ButB
  166. WeldB.Part0 = Handle
  167. WeldB.Part1 = ButB
  168. WeldB.C0 = CFrame.new(-0.1,0.4,-0.3) * CFrame.Angles(math.pi/2+0.1,0,0)
  169.  
  170. --[[ * Hinge * ]]--
  171.  
  172. Hinge = Instance.new("Part")
  173. Hinge.formFactor = "Custom"
  174. Hinge.Locked = true
  175. Hinge.CanCollide = false
  176. Hinge.BrickColor = BrickColor.new("Medium stone grey")
  177. Hinge.Anchored = false
  178. Hinge.Size = Vector3.new(0.2,0.25,0.2)
  179. Hinge.TopSurface = 0
  180. Hinge.BottomSurface = 0
  181. Hinge.Parent = Gun
  182. MeshB = Instance.new("CylinderMesh",Hinge)
  183. WeldQ = Instance.new("Weld")
  184. WeldQ.Parent = Hinge
  185. WeldQ.Part0 = Handle
  186. WeldQ.Part1 = Hinge
  187. WeldQ.C0 = CFrame.new(0,0.3,-0.6) * CFrame.Angles(math.pi/2+0.1,0,math.pi/2)
  188.  
  189. --[[ * HingeP * ]]--
  190.  
  191. HingeP = Instance.new("Part")
  192. HingeP.formFactor = "Custom"
  193. HingeP.Locked = true
  194. HingeP.CanCollide = false
  195. HingeP.BrickColor = BrickColor.new("Medium stone grey")
  196. HingeP.Anchored = false
  197. HingeP.Size = Vector3.new(0.2,0.5,0.2)
  198. HingeP.TopSurface = 0
  199. HingeP.BottomSurface = 0
  200. HingeP.Parent = Gun
  201. MeshB = Instance.new("CylinderMesh",HingeP)
  202. WeldB = Instance.new("Weld")
  203. WeldB.Parent = HingeP
  204. WeldB.Part0 = Hinge
  205. WeldB.Part1 = HingeP
  206. WeldB.C0 = CFrame.new(-0.25,0,0) * CFrame.Angles(0,0,math.pi/2)
  207.  
  208. --[[ * BarrelA * ]]--
  209.  
  210. BarrelA = Instance.new("Part")
  211. BarrelA.formFactor = "Custom"
  212. BarrelA.Locked = true
  213. BarrelA.CanCollide = false
  214. BarrelA.BrickColor = BrickColor.new("Really black")
  215. BarrelA.Anchored = false
  216. BarrelA.Size = Vector3.new(0.3,1.5,0.3)
  217. BarrelA.TopSurface = 0
  218. BarrelA.BottomSurface = 0
  219. BarrelA.Parent = Gun
  220. MeshB = Instance.new("CylinderMesh",BarrelA)
  221. WeldB = Instance.new("Weld")
  222. WeldB.Parent = BarrelA
  223. WeldB.Part0 = Hinge
  224. WeldB.Part1 = BarrelA
  225. WeldB.C0 = CFrame.new(-0.75,0.1,-0.125) * CFrame.Angles(0,0,math.pi/2)
  226.  
  227. --[[ * BarrelB * ]]--
  228.  
  229. BarrelB = Instance.new("Part")
  230. BarrelB.formFactor = "Custom"
  231. BarrelB.Locked = true
  232. BarrelB.CanCollide = false
  233. BarrelB.BrickColor = BrickColor.new("Really black")
  234. BarrelB.Anchored = false
  235. BarrelB.Size = Vector3.new(0.3,1.5,0.3)
  236. BarrelB.TopSurface = 0
  237. BarrelB.BottomSurface = 0
  238. BarrelB.Parent = Gun
  239. MeshB = Instance.new("CylinderMesh",BarrelB)
  240. WeldB = Instance.new("Weld")
  241. WeldB.Parent = BarrelB
  242. WeldB.Part0 = Hinge
  243. WeldB.Part1 = BarrelB
  244. WeldB.C0 = CFrame.new(-0.75,-0.1,-0.125) * CFrame.Angles(0,0,math.pi/2)
  245.  
  246. --[[ * Variables * ]]--
  247.  
  248. Head = false
  249. Ammo = 2
  250. Arms = false
  251. Hopper = Instance.new("HopperBin")
  252.  
  253. function TName()
  254. Hopper.Name = "Gun: "..Ammo
  255. end
  256.  
  257. --[[ * Animation * ]]--
  258.  
  259. function ArmsOn()
  260. for i = 1,10 do wait()
  261. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2,-math.pi/11/2/2,math.pi/10/2/2)
  262. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0.1,0.05,-0.05)
  263. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,-math.pi/10/2/2/2)
  264. ArmWeld.C0 = ArmWeld.C0 + Vector3.new(-0.05,0,0.09)
  265. end
  266. end
  267.  
  268. function ArmsOff()
  269. for i = 1,10 do wait()
  270. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0.1,0.05,-0.05)
  271. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2,math.pi/11/2/2,-math.pi/10/2/2)
  272. ArmWeld.C0 = ArmWeld.C0 - Vector3.new(-0.05,0,0.09)
  273. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,math.pi/10/2/2/2)
  274. end
  275. for i = 1,3 do wait()
  276. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(0,0,0.05)
  277. end
  278. ArmWeldR.C0 = CFrame.new(-1.5,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  279. end
  280.  
  281. function SuicideYes()
  282. for i = 1,10 do wait()
  283. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,math.pi/10/2/2)
  284. WeldA.C0 = WeldA.C0 * CFrame.Angles(0,math.pi/11,0)
  285. end
  286. end
  287.  
  288. function SuicideNo()
  289. for i = 1,10 do wait()
  290. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,-math.pi/10/2/2)
  291. WeldA.C0 = WeldA.C0 * CFrame.Angles(0,-math.pi/11,0)
  292. end
  293. end
  294.  
  295. function Reload()
  296. if Ammo == 0 then
  297. if Head == true then SuicideNo() end
  298. NewSoundI("http://www.roblox.com/Asset/?id=2761842",10,1,Handle,1.2)
  299. if Arms == false then
  300. for i = 1,10 do wait()
  301. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2,-math.pi/11/2/2,math.pi/10/2/2)
  302. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0.1,0.05,-0.05)
  303. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,-math.pi/10/2/2/2)
  304. ArmWeld.C0 = ArmWeld.C0 + Vector3.new(-0.05,0,0.09)
  305. end
  306. end
  307. for i = 1,10 do wait()
  308. WeldQ.C0 = WeldQ.C0 * CFrame.Angles(0,math.pi/10/2/2,0)
  309. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2/2/2,0,0)
  310. end
  311. for i = 1,10 do wait()
  312. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2/2/2,0,0)
  313. end
  314. for i = 1,9 do wait()
  315. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0.1,0.05,-0.05)
  316. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2,math.pi/11/2/2,-math.pi/10/2/2)
  317. end
  318. for i = 1,3 do wait()
  319. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(-0.1,0.05,-0.05)
  320. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2,math.pi/11/2/2,math.pi/10/2/2)
  321. end
  322. for i = 1,3 do wait()
  323. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(-0.1,0.05,-0.05)
  324. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2,-math.pi/11/2/2,-math.pi/10/2/2)
  325. end
  326. for i = 1,9 do wait()
  327. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0.1,0.05,-0.05)
  328. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2,-math.pi/11/2/2,math.pi/10/2/2)
  329. end
  330. for i = 1,5 do wait()
  331. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/4/2/2/2,0,0)
  332. end
  333. Ammo = 1
  334. TName()
  335. NewSound("http://www.roblox.com/Asset/?id=13510352",2,10,Handle)
  336. for i = 1,5 do wait()
  337. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/4/2/2/2,0,0)
  338. end
  339. NewSound("http://www.roblox.com/Asset/?id=13510352",2,10,Handle)
  340. for i = 1,9 do wait()
  341. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0.1,0.05,-0.05)
  342. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2,math.pi/11/2/2,-math.pi/10/2/2)
  343. end
  344. for i = 1,3 do wait()
  345. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(-0.1,0.05,-0.05)
  346. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2,math.pi/11/2/2,math.pi/10/2/2)
  347. end
  348. for i = 1,3 do wait()
  349. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(-0.1,0.05,-0.05)
  350. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2,-math.pi/11/2/2,-math.pi/10/2/2)
  351. end
  352. for i = 1,9 do wait()
  353. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0.1,0.05,-0.05)
  354. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/10/2,-math.pi/11/2/2,math.pi/10/2/2)
  355. end
  356. for i = 1,5 do wait()
  357. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/4/2/2/2,0,0)
  358. end
  359. Ammo = 2
  360. TName()
  361. NewSound("http://www.roblox.com/Asset/?id=13510352",2,10,Handle)
  362. for i = 1,5 do wait()
  363. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/4/2/2/2,0,0)
  364. end
  365. NewSound("http://www.roblox.com/Asset/?id=13510352",2,10,Handle)
  366. for i = 1,10 do wait()
  367. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/10/2,math.pi/11/2/2,-math.pi/10/2/2)
  368. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0.1,0.05,-0.05)
  369. end
  370. for i = 1,10 do wait()
  371. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(0,0,0.05)
  372. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(0,0,math.pi/10/2/2/2)
  373. ArmWeld.C0 = ArmWeld.C0 - Vector3.new(-0.05,0,0.09)
  374. end
  375. ArmWeldR.C0 = CFrame.new(-1.5,0,0) * CFrame.fromEulerAnglesXYZ(0,0,0)
  376. NewSound("http://www.roblox.com/Asset/?id=10209881",10,0.9,Handle)
  377. for i = 1,5 do wait()
  378. WeldQ.C0 = WeldQ.C0 * CFrame.Angles(0,-math.pi/5/2/2,0)
  379. ArmWeld.C0 = ArmWeld.C0 * CFrame.new(0,0,-0.1) * CFrame.Angles(math.pi/5/2/2,0,0)
  380. end
  381. for i = 1,10 do wait()
  382. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(-math.pi/10/2/2,0,0) * CFrame.new(0,0,0.05)
  383. end
  384. ArmWeld.C0 = CFrame.new(1.5,0.5,-0.5) * CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)
  385. Ammo = 2
  386. TName()
  387. if Head == true then SuicideYes() end
  388. if Arms == true then ArmsOn() end
  389. elseif Ammo ~= 0 then
  390. if Arms == false then ArmsOn() end
  391. wait(0.1)
  392. NewSound("http://www.roblox.com/Asset/?id=10209881",10,1,Handle)
  393. for i = 1,10 do wait()
  394. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0,0,0.1)
  395. end
  396. --Ammo = Ammo - 1
  397. TName()
  398. for i = 1,10 do wait()
  399. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0,0,0.1)
  400. end
  401. if Arms == false then ArmsOff() end
  402. end
  403. end
  404.  
  405. function Shoot()
  406. NewSound("http://www.roblox.com/Asset/?id=2691586",10,1,Handle)
  407. if Arms == false then
  408. for i = 1,5 do wait()
  409. ArmWeld.C0 = ArmWeld.C0 * CFrame.new(0,0,-0.1) * CFrame.Angles(math.pi/5/2/2,0,0)
  410. WeldA.C0 = WeldA.C0 * CFrame.Angles(0.2,0,0)
  411. end
  412. for i = 1,10 do wait()
  413. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(-math.pi/10/2/2,0,0) * CFrame.new(0,0,0.05)
  414. WeldA.C0 = WeldA.C0 * CFrame.Angles(-0.1,0,0)
  415. end
  416. if Arms == false then ArmsOn() end
  417. wait(0.05)
  418. NewSound("http://www.roblox.com/Asset/?id=10209881",10,1,Handle)
  419. for i = 1,5 do wait()
  420. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0,0,0.2)
  421. end
  422. Ammo = Ammo - 1 TName()
  423. wait(0.1)
  424. for i = 1,5 do wait()
  425. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0,0,0.2)
  426. end
  427. if Arms == false then ArmsOff() end
  428. elseif Arms == true then
  429. for i = 1,5 do wait()
  430. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(math.pi/4/2/2/2,0,0)
  431. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0,0.2,0)
  432. ArmWeld.C0 = ArmWeld.C0 * CFrame.new(0,0,-0.1) * CFrame.Angles(math.pi/5/2/2,0,0)
  433. WeldA.C0 = WeldA.C0 * CFrame.Angles(0.2,0,0)
  434. end
  435. for i = 1,10 do wait()
  436. ArmWeldR.C0 = ArmWeldR.C0 * CFrame.Angles(-math.pi/8/2/2/2,0,0)
  437. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0,0.1,0)
  438. ArmWeld.C0 = ArmWeld.C0 * CFrame.Angles(-math.pi/10/2/2,0,0) * CFrame.new(0,0,0.05)
  439. WeldA.C0 = WeldA.C0 * CFrame.Angles(-0.1,0,0)
  440. end
  441. NewSound("http://www.roblox.com/Asset/?id=10209881",10,1,Handle)
  442. for i = 1,5 do wait()
  443. ArmWeldR.C0 = ArmWeldR.C0 - Vector3.new(0,0,0.2)
  444. end
  445. Ammo = Ammo - 1 TName()
  446. wait(0.1)
  447. for i = 1,5 do wait()
  448. ArmWeldR.C0 = ArmWeldR.C0 + Vector3.new(0,0,0.2)
  449. end
  450. end
  451. end
  452.  
  453. --[[ * Sound * ]]--
  454.  
  455. function NewSound(ID,V,P,N)
  456. coroutine.resume(coroutine.create(function()
  457. local SoundD = Instance.new("Sound")
  458. SoundD.SoundId = ID
  459. SoundD.Volume = V
  460. SoundD.Pitch = P
  461. SoundD.Parent = N
  462. SoundD:Play()
  463. while SoundD.IsPlaying do wait() end
  464. SoundD:Remove()
  465. end))
  466. end
  467.  
  468. function NewSoundI(ID,V,P,N,I)
  469. coroutine.resume(coroutine.create(function()
  470. local SoundD = Instance.new("Sound")
  471. SoundD.SoundId = ID
  472. SoundD.Volume = V
  473. SoundD.Pitch = P
  474. SoundD.Parent = N
  475. SoundD:Play()
  476. wait(I)
  477. SoundD:Stop()
  478. wait()
  479. SoundD:Remove()
  480. end))
  481. end
  482.  
  483. --[[ * Tool * ]]--
  484.  
  485. if script.Parent.Name == Player.Name then
  486. Hopper = Instance.new("HopperBin")
  487. Hopper.Name = "Gun"
  488. Hopper.Parent = Player.Backpack
  489. end
  490.  
  491. Blah = true
  492. ABC = BarrelA.CFrame
  493.  
  494. function Clicked(Mouse)
  495. if Blah == true then
  496. Blah = false
  497. if Ammo == 0 then
  498. Reload()
  499. else
  500. if Head == true then Character.Head:BreakJoints() return end
  501. coroutine.resume(coroutine.create(function()
  502. Mouse.Target:BreakJoints()
  503. end))
  504. Shoot()
  505. end
  506. Blah = true
  507. return
  508. end
  509. end
  510.  
  511. function onKeyDown(key)
  512. if Blah == true then
  513. Blah = false
  514.  
  515. if key == "p" then
  516. NewSound("",10,0.5,Handle)
  517. end
  518.  
  519. if key == "0" or key == "/" then
  520. if not Head then
  521. if Arms == false then
  522. ArmsOn()
  523. Arms = true
  524. elseif Arms == true then
  525. ArmsOff()
  526. Arms = false
  527. end
  528. end
  529. end
  530.  
  531. if key == "" then
  532. if not Head then
  533. if Arms then ArmsOff() Arms = false end
  534. SuicideYes()
  535. Head = true
  536. elseif Head then
  537. SuicideNo()
  538. if Arms then ArmsOn() end
  539. Head = false
  540. end
  541. end
  542.  
  543. if key == "r" then
  544. Reload()
  545. end
  546.  
  547. Blah = true
  548. return
  549. end
  550. end
  551.  
  552. function Selected(Mouse)
  553. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  554. Mouse.KeyDown:connect(onKeyDown)
  555. Mouse.Button1Down:connect(function()Clicked(Mouse)end)
  556. TName()
  557. if Blah then
  558. Blah = false
  559. if not Arms then
  560. ArmsOn()
  561. Arms = true
  562. end
  563. Blah = true
  564. end
  565. end
  566.  
  567. function Deselected(Mouse)
  568. if Blah then
  569. Blah = false
  570. if Arms then
  571. ArmsOff()
  572. Arms = false
  573. end
  574. Blah = true
  575. end
  576. end
  577.  
  578. function Dead()
  579. for i,v in pairs(Character:GetChildren()) do
  580. pcall(function() v.Anchored = true end)
  581. if v.Name == "Head" then v.Anchored = false v.Velocity = Vector3.new(10,0,10) end
  582. for i,a in pairs(v:GetChildren()) do pcall(function() a.Anchored = true end) end
  583. end
  584. end
  585.  
  586. Character.Humanoid.Died:connect(Dead)
  587. Hopper.Selected:connect(Selected)
  588. Hopper.Deselected:connect(Deselected)
Add Comment
Please, Sign In to add comment