Advertisement
allenjamelsim

Roblox Gun Script

Sep 6th, 2015
854
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Jaginator's MP412
  3. --]]
  4.  
  5.  
  6. if script == nil then return end
  7.  
  8.  
  9. Player = game.Players.ericthefabulous
  10. Name = "MP412"
  11. MC = BrickColor.new("Really blue")
  12. GC = BrickColor.new("Really red")
  13. Spread = 90000
  14. MR = 0.15
  15. Chamber = 1
  16. Loaded = 0
  17. Scoped = false
  18. Scoped = false
  19. selected = false
  20. Hammer = true
  21. canDual = false
  22. dual = true
  23. Button1Down = false
  24. damage = 10
  25. canFire = false
  26. canFire2 = true
  27. readyTime = 0.000023
  28. automatic = false
  29. burst = false
  30. burstCount = 0
  31. burstCountMax = 3
  32. canSilence = false
  33. silenced = false
  34. canZoom = true
  35. zoom = false
  36. switchToSingle = true
  37. switchToBurst = true
  38. switchToAutomatic = true
  39.  
  40.  
  41. ammoGui = Instance.new("ScreenGui")
  42. ammoGui.Name = Name
  43. local frame = Instance.new("Frame")
  44. frame.Name = "Frame"
  45. frame.Size = UDim2.new(0, 165, 0, 60)
  46. frame.Position = UDim2.new(0, 0, 1, -400)
  47. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  48. frame.BorderColor3 = Color3.new(0, 0, 0)
  49. frame.Parent = ammoGui
  50. local label = Instance.new("TextLabel")
  51. label.Name = "Weapon"
  52. label.Text = "Weapon: " ..Name
  53. label.Size = UDim2.new(1, 0, 0, 20)
  54. label.Position = UDim2.new(0, 0, 0, 0)
  55. label.BackgroundColor3 = Color3.new(1, 0, 0)
  56. label.BorderColor3 = Color3.new(0, 0, 0)
  57. label.Parent = frame
  58. local label = Instance.new("TextLabel")
  59. label.Name = "MagazinePrefix"
  60. label.Text = " Magazine:"
  61. label.TextXAlignment = "Left"
  62. label.Size = UDim2.new(1, 0, 0, 20)
  63. label.Position = UDim2.new(0, 0, 0, 20)
  64. label.BackgroundColor3 = Color3.new(1, 1, 1)
  65. label.BorderColor3 = Color3.new(0, 0, 0)
  66. label.Parent = frame
  67. local label = Instance.new("TextLabel")
  68. label.Name = "Magazine"
  69. label.Text = "0/0"
  70. label.TextXAlignment = "Right"
  71. label.Size = UDim2.new(1, 0, 0, 20)
  72. label.Position = UDim2.new(0, -10, 0, 20)
  73. label.BackgroundTransparency = 1
  74. label.BorderSizePixel = 0
  75. label.Parent = frame
  76. local label = Instance.new("TextLabel")
  77. label.Name = "AmmoPrefix"
  78. label.Text = " .357 Magnum:"
  79. label.TextXAlignment = "Left"
  80. label.Size = UDim2.new(1, 0, 0, 20)
  81. label.Position = UDim2.new(0, 0, 0, 40)
  82. label.BackgroundColor3 = Color3.new(1, 1, 1)
  83. label.BorderColor3 = Color3.new(0, 0, 0)
  84. label.Parent = frame
  85. local label = Instance.new("TextLabel")
  86. label.Name = "Ammo"
  87. label.Text = "0/0"
  88. label.TextXAlignment = "Right"
  89. label.Size = UDim2.new(1, 0, 0, 20)
  90. label.Position = UDim2.new(0, -10, 0, 40)
  91. label.BackgroundTransparency = 1
  92. label.BorderSizePixel = 0
  93. label.Parent = frame
  94.  
  95.  
  96. function updateGui()
  97. if selected == false then return end
  98. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  99. if Player.PlayerGui:FindFirstChild(Name) == nil then
  100. ammoGui:Clone().Parent = Player.PlayerGui
  101. end
  102. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  103. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  104. end
  105.  
  106.  
  107. function makeParts(format)
  108. local model = Instance.new("Model")
  109. model.Name = Name
  110. local pm = Instance.new("Part")
  111. pm.Name = "Handle"
  112. pm.formFactor = "Symmetric"
  113. pm.Size = Vector3.new(1, 1, 1)
  114. pm.BrickColor = MC
  115. pm.Reflectance = MR
  116. pm.Transparency = 1
  117. pm.CanCollide = false
  118. pm.Locked = true
  119. pm.TopSurface = 0
  120. pm.BottomSurface = 0
  121. pm.Parent = model
  122. local m = Instance.new("SpecialMesh")
  123. m.MeshType = "Brick"
  124. m.Scale = Vector3.new(0.3, 0.8, 0.4)
  125. m.Parent = pm
  126. if format ~= nil then
  127. local w = Instance.new("Weld")
  128. w.Part0 = pm
  129. if format == "RightHand" then
  130. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  131. w.C0 = CFrame.new(0, 0.9, 0.68)
  132. w.C1 = CFrame.new()
  133. elseif format == "LeftHand" then
  134. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  135. w.C0 = CFrame.new(0, 0.9, 0.68)
  136. w.C1 = CFrame.new()
  137. model.Name = Name.. " (Left)"
  138. elseif format == "RightHolster" then
  139. w.Part1 = Player.Character:FindFirstChild("Right Leg")
  140. w.C0 = CFrame.new(-0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  141. w.C1 = CFrame.new()
  142. w.Parent = pm
  143. model.Name = Name.. " (Holstered)"
  144. elseif format == "LeftHolster" then
  145. w.Part1 = Player.Character:FindFirstChild("Left Leg")
  146. w.C0 = CFrame.new(0.65, -0.25, 0) * CFrame.fromEulerAnglesXYZ(math.rad(25), 0, 0)
  147. w.C1 = CFrame.new()
  148. model.Name = Name.. " (Holstered, Left)"
  149. end
  150. w.Parent = pm
  151. model.Parent = Player.Character
  152. end
  153. local s = Instance.new("Sound")
  154. s.Name = "Fire"
  155. s.SoundId = "http://www.roblox.com/Asset/?id=10209875"
  156. s.Volume = .5
  157. s.Pitch = 50
  158. s.Looped = false
  159. s.Parent = pm
  160. local s = Instance.new("Sound")
  161. s.Name = "Reload"
  162. s.SoundId = "http://www.roblox.com/Asset/?id=10209894"
  163. s.Volume = 0.8
  164. s.Pitch = 4
  165. s.Looped = false
  166. s.Parent = pm
  167. local s = Instance.new("Sound")
  168. s.Name = "Empty"
  169. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  170. s.Volume = 1
  171. s.Pitch = 5
  172. s.Looped = false
  173. s.Parent = pm
  174. local s = Instance.new("Sound")
  175. s.Name = "Lock"
  176. s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
  177. s.Volume = 1
  178. s.Pitch = 3
  179. s.Looped = false
  180. s.Parent = pm
  181. local s = Instance.new("Sound")
  182. s.Name = "Release"
  183. s.SoundId = "http://www.roblox.com/Asset/?id=10209813"
  184. s.Volume = 1
  185. s.Pitch = 4
  186. s.Looped = false
  187. s.Parent = pm
  188. local s = Instance.new("Sound")
  189. s.Name = "Switch"
  190. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  191. s.Volume = 1
  192. s.Pitch = 10
  193. s.Looped = false
  194. s.Parent = pm
  195. local p = Instance.new("Part")
  196. p.Name = "ShellOut"
  197. p.formFactor = "Symmetric"
  198. p.Size = Vector3.new(1, 1, 1)
  199. p.Transparency = 1
  200. p.Locked = true
  201. p.CanCollide = false
  202. p.TopSurface = 0
  203. p.BottomSurface = 0
  204. p.Parent = model
  205. local w = Instance.new("Weld")
  206. w.Part0 = p
  207. w.Part1 = pm
  208. w.C0 = CFrame.new(0.5, 0, 0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0)
  209. w.C1 = CFrame.new()
  210. w.Parent = p
  211. local p = Instance.new("Part")
  212. p.Name = "Grip"
  213. p.formFactor = "Symmetric"
  214. p.Size = Vector3.new(1, 1, 1)
  215. p.BrickColor = GC
  216. p.CanCollide = false
  217. p.Locked = true
  218. p.TopSurface = 0
  219. p.BottomSurface = 0
  220. p.Parent = model
  221. local m = Instance.new("BlockMesh")
  222. m.Scale = Vector3.new(0.261, 0.42, 0.7)
  223. m.Parent = p
  224. local w = Instance.new("Weld")
  225. w.Part0 = p
  226. w.Part1 = pm
  227. w.C0 = CFrame.new(0, -0.022, -0.4) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  228. w.C1 = CFrame.new()
  229. w.Parent = p
  230. local p = Instance.new("Part")
  231. p.Name = "TriggerGuard"
  232. p.formFactor = "Symmetric"
  233. p.Size = Vector3.new(1, 1, 1)
  234. p.BrickColor = GC
  235. p.CanCollide = false
  236. p.Locked = true
  237. p.TopSurface = 0
  238. p.BottomSurface = 0
  239. p.Parent = model
  240. local m = Instance.new("SpecialMesh")
  241. m.MeshType = "FileMesh"
  242. m.MeshId = "http://www.roblox.com/asset/?id=3270017"
  243. m.Scale = Vector3.new(0.3, 0.3, 0.8)
  244. m.Parent = p
  245. local w = Instance.new("Weld")
  246. w.Part0 = p
  247. w.Part1 = pm
  248. w.C0 = CFrame.new(-0.21, 0.16, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  249. w.C1 = CFrame.new()
  250. w.Parent = p
  251. local p = Instance.new("Part")
  252. p.Name = "Trigger"
  253. p.formFactor = "Symmetric"
  254. p.Size = Vector3.new(1, 1, 1)
  255. p.BrickColor = GC
  256. p.CanCollide = false
  257. p.Locked = true
  258. p.TopSurface = 0
  259. p.BottomSurface = 0
  260. p.Parent = model
  261. local m = Instance.new("BlockMesh")
  262. m.Scale = Vector3.new(0.1, 0.4, 0.16)
  263. m.Parent = p
  264. local w = Instance.new("Weld")
  265. w.Part0 = p
  266. w.Part1 = pm
  267. w.C0 = CFrame.new(0, 0.04, -0.22)
  268. w.C1 = CFrame.new()
  269. w.Parent = p
  270. local p = Instance.new("Part")
  271. p.Name = "Base"
  272. p.CanCollide = false
  273. p.formFactor = "Symmetric"
  274. p.Size = Vector3.new(1, 1, 1)
  275. p.BrickColor = GC
  276. p.Locked = true
  277. p.TopSurface = 0
  278. p.BottomSurface = 0
  279. p.Parent = model
  280. local m = Instance.new("BlockMesh")
  281. m.Scale = Vector3.new(0.26, 0.72, 0.1)
  282. m.Parent = p
  283. local w = Instance.new("Weld")
  284. w.Part0 = p
  285. w.Part1 = pm
  286. w.C0 = CFrame.new(0, 0.09, -0.1)
  287. w.C1 = CFrame.new()
  288. w.Parent = p
  289. local p = Instance.new("Part")
  290. p.Name = "Body"
  291. p.formFactor = "Symmetric"
  292. p.Size = Vector3.new(1, 1, 1)
  293. p.BrickColor = GC
  294. p.CanCollide = false
  295. p.Locked = true
  296. p.TopSurface = 0
  297. p.BottomSurface = 0
  298. p.Parent = model
  299. local m = Instance.new("BlockMesh")
  300. m.Scale = Vector3.new(0.26, 0.1, 0.28)
  301. m.Parent = p
  302. local w = Instance.new("Weld")
  303. w.Part0 = p
  304. w.Part1 = pm
  305. w.C0 = CFrame.new(0, 0, 0.03)
  306. w.C1 = CFrame.new()
  307. w.Parent = p
  308. local p = Instance.new("Part")
  309. p.Name = "Body"
  310. p.formFactor = "Symmetric"
  311. p.Size = Vector3.new(1, 1, 1)
  312. p.BrickColor = GC
  313. p.CanCollide = false
  314. p.Locked = true
  315. p.TopSurface = 0
  316. p.BottomSurface = 0
  317. p.Parent = model
  318. local m = Instance.new("SpecialMesh")
  319. m.MeshType = "Wedge"
  320. m.Scale = Vector3.new(0.086, 0.2, 0.15)
  321. m.Parent = p
  322. local w = Instance.new("Weld")
  323. w.Part0 = p
  324. w.Part1 = pm
  325. w.C0 = CFrame.new(0.086, -0.15, 0.08)
  326. w.C1 = CFrame.new()
  327. w.Parent = p
  328. local p = Instance.new("Part")
  329. p.Name = "Body"
  330. p.formFactor = "Symmetric"
  331. p.Size = Vector3.new(1, 1, 1)
  332. p.BrickColor = GC
  333. p.CanCollide = false
  334. p.Locked = true
  335. p.TopSurface = 0
  336. p.BottomSurface = 0
  337. p.Parent = model
  338. local m = Instance.new("SpecialMesh")
  339. m.MeshType = "Wedge"
  340. m.Scale = Vector3.new(0.086, 0.2, 0.15)
  341. m.Parent = p
  342. local w = Instance.new("Weld")
  343. w.Part0 = p
  344. w.Part1 = pm
  345. w.C0 = CFrame.new(-0.086, -0.15, 0.08)
  346. w.C1 = CFrame.new()
  347. w.Parent = p
  348. local p = Instance.new("Part")
  349. p.Name = "Body"
  350. p.formFactor = "Symmetric"
  351. p.Size = Vector3.new(1, 1, 1)
  352. p.BrickColor = GC
  353. p.CanCollide = false
  354. p.Locked = true
  355. p.TopSurface = 0
  356. p.BottomSurface = 0
  357. p.Parent = model
  358. local m = Instance.new("SpecialMesh")
  359. m.MeshType = "Wedge"
  360. m.Scale = Vector3.new(0.086, 0.2, 0.075)
  361. m.Parent = p
  362. local w = Instance.new("Weld")
  363. w.Part0 = p
  364. w.Part1 = pm
  365. w.C0 = CFrame.new(0, -0.15, 0.02)
  366. w.C1 = CFrame.new()
  367. w.Parent = p
  368. local p = Instance.new("Part")
  369. p.Name = "Hammer"
  370. p.formFactor = "Symmetric"
  371. p.Size = Vector3.new(1, 1, 1)
  372. p.BrickColor = MC
  373. p.Reflectance = MR
  374. p.CanCollide = false
  375. p.Locked = true
  376. p.TopSurface = 0
  377. p.BottomSurface = 0
  378. p.Parent = model
  379. local m = Instance.new("BlockMesh")
  380. m.Scale = Vector3.new(0.086, 0.1, 0.3)
  381. m.Parent = p
  382. local w = Instance.new("Weld")
  383. w.Part0 = p
  384. w.Part1 = pm
  385. if Hammer == false then
  386. w.C0 = CFrame.new(0, -0.1, 0.08)
  387. else
  388. w.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0)
  389. end
  390. w.C1 = CFrame.new()
  391. w.Parent = p
  392. local p = Instance.new("Part")
  393. p.Name = "Body"
  394. p.formFactor = "Symmetric"
  395. p.Size = Vector3.new(1, 1, 1)
  396. p.BrickColor = GC
  397. p.CanCollide = false
  398. p.Locked = true
  399. p.TopSurface = 0
  400. p.BottomSurface = 0
  401. p.Parent = model
  402. local m = Instance.new("BlockMesh")
  403. m.Scale = Vector3.new(0.26, 0.22, 0.1)
  404. m.Parent = p
  405. local w = Instance.new("Weld")
  406. w.Part0 = p
  407. w.Part1 = pm
  408. w.C0 = CFrame.new(0, -0.16, -0.02)
  409. w.C1 = CFrame.new()
  410. w.Parent = p
  411. local pv1 = Instance.new("Part")
  412. pv1.Name = "Pivot1"
  413. pv1.formFactor = "Symmetric"
  414. pv1.Size = Vector3.new(1, 1, 1)
  415. pv1.BrickColor = MC
  416. pv1.Reflectance = MR
  417. pv1.CanCollide = false
  418. pv1.Locked = true
  419. pv1.TopSurface = 0
  420. pv1.BottomSurface = 0
  421. pv1.Parent = model
  422. local m = Instance.new("CylinderMesh")
  423. m.Scale = Vector3.new(0.15, 0.261, 0.15)
  424. m.Parent = pv1
  425. local w = Instance.new("Weld")
  426. w.Part0 = pv1
  427. w.Part1 = pm
  428. w.C0 = CFrame.new(-0.45, 0, -0.04) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  429. w.C1 = CFrame.new()
  430. w.Parent = pv1
  431. local pv = Instance.new("Part")
  432. pv.Name = "Pivot"
  433. pv.formFactor = "Symmetric"
  434. pv.Size = Vector3.new(1, 1, 1)
  435. pv.BrickColor = BrickColor.new("Lime green")
  436. pv.Reflectance = MR
  437. pv.CanCollide = false
  438. pv.Locked = true
  439. pv.TopSurface = 0
  440. pv.BottomSurface = 0
  441. pv.Parent = model
  442. local m = Instance.new("CylinderMesh")
  443. m.Scale = Vector3.new(0.1, 0.27, 0.1)
  444. m.Parent = pv
  445. local w = Instance.new("Weld")
  446. w.Part0 = pv
  447. w.Part1 = pv1
  448. w.C0 = CFrame.new(0, 0, 0)
  449. w.C1 = CFrame.new()
  450. w.Parent = pv
  451. local p = Instance.new("Part")
  452. p.Name = "Barrel1"
  453. p.formFactor = "Symmetric"
  454. p.Size = Vector3.new(1, 1, 1)
  455. p.BrickColor = MC
  456. p.Reflectance = MR
  457. p.CanCollide = false
  458. p.Locked = true
  459. p.TopSurface = 0
  460. p.BottomSurface = 0
  461. p.Parent = model
  462. local m = Instance.new("BlockMesh")
  463. m.Scale = Vector3.new(0.15, 0.26, 0.28)
  464. m.Parent = p
  465. local w = Instance.new("Weld")
  466. w.Part0 = p
  467. w.Part1 = pv
  468. w.C0 = CFrame.new(0, 0, 0.14)
  469. w.C1 = CFrame.new()
  470. w.Parent = p
  471. local p = Instance.new("Part")
  472. p.Name = "Barrel2"
  473. p.formFactor = "Symmetric"
  474. p.Size = Vector3.new(1, 1, 1)
  475. p.BrickColor = MC
  476. p.Reflectance = MR
  477. p.CanCollide = false
  478. p.Locked = true
  479. p.TopSurface = 0
  480. p.BottomSurface = 0
  481. p.Parent = model
  482. local m = Instance.new("BlockMesh")
  483. m.Scale = Vector3.new(0.6, 0.2, 0.28)
  484. m.Parent = p
  485. local w = Instance.new("Weld")
  486. w.Part0 = p
  487. w.Part1 = pv
  488. w.C0 = CFrame.new(-0.36, 0, 0.14)
  489. w.C1 = CFrame.new()
  490. w.Parent = p
  491. local p = Instance.new("Part")
  492. p.Name = "Barrel3"
  493. p.formFactor = "Symmetric"
  494. p.Size = Vector3.new(1, 1, 1)
  495. p.BrickColor = MC
  496. p.Reflectance = MR
  497. p.CanCollide = false
  498. p.Locked = true
  499. p.TopSurface = 0
  500. p.BottomSurface = 0
  501. p.Parent = model
  502. local m = Instance.new("BlockMesh")
  503. m.Scale = Vector3.new(0.6, 0.26, 0.22)
  504. m.Parent = p
  505. local w = Instance.new("Weld")
  506. w.Part0 = p
  507. w.Part1 = pv
  508. w.C0 = CFrame.new(-0.36, 0, 0.14)
  509. w.C1 = CFrame.new()
  510. w.Parent = p
  511. local p = Instance.new("Part")
  512. p.Name = "Hole"
  513. p.formFactor = "Symmetric"
  514. p.Size = Vector3.new(1, 1, 1)
  515. p.BrickColor = BrickColor.new("New Yeller")
  516. p.Reflectance = 0
  517. p.CanCollide = false
  518. p.Locked = true
  519. p.TopSurface = 0
  520. p.BottomSurface = 0
  521. p.Parent = model
  522. local m = Instance.new("CylinderMesh")
  523. m.Scale = Vector3.new(0.1, 0.602, 0.1)
  524. m.Parent = p
  525. local w = Instance.new("Weld")
  526. w.Part0 = p
  527. w.Part1 = pv
  528. w.C0 = CFrame.new(0, -0.36, 0.18) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  529. w.C1 = CFrame.new()
  530. w.Parent = p
  531. local p = Instance.new("Part")
  532. p.Name = "Top"
  533. p.formFactor = "Symmetric"
  534. p.Size = Vector3.new(1, 1, 1)
  535. p.BrickColor = MC
  536. p.Reflectance = MR
  537. p.CanCollide = false
  538. p.Locked = true
  539. p.TopSurface = 0
  540. p.BottomSurface = 0
  541. p.Parent = model
  542. local m = Instance.new("BlockMesh")
  543. m.Scale = Vector3.new(0.5, 0.26, 0.08)
  544. m.Parent = p
  545. local w = Instance.new("Weld")
  546. w.Part0 = p
  547. w.Part1 = pv
  548. w.C0 = CFrame.new(0.25, 0, 0.24)
  549. w.C1 = CFrame.new()
  550. w.Parent = p
  551. if Scoped == true then
  552. canZoom = true
  553. local p = Instance.new("Part")
  554. p.Name = "Scope"
  555. p.formFactor = "Symmetric"
  556. p.Size = Vector3.new(1, 1, 1)
  557. p.BrickColor = GC
  558. p.CanCollide = false
  559. p.Locked = true
  560. p.TopSurface = 0
  561. p.BottomSurface = 0
  562. p.Parent = model
  563. local m = Instance.new("CylinderMesh")
  564. m.Scale = Vector3.new(0.24, 0.5, 0.24)
  565. m.Parent = p
  566. local w = Instance.new("Weld")
  567. w.Part0 = p
  568. w.Part1 = pv
  569. w.C0 = CFrame.new(0, -0.2, 0.38) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  570. w.C1 = CFrame.new()
  571. w.Parent = p
  572. local p = Instance.new("Part")
  573. p.Name = "Scope"
  574. p.formFactor = "Symmetric"
  575. p.Size = Vector3.new(1, 1, 1)
  576. p.BrickColor = BrickColor.new("White")
  577. p.Reflectance = 0.5
  578. p.CanCollide = false
  579. p.Locked = true
  580. p.TopSurface = 0
  581. p.BottomSurface = 0
  582. p.Parent = model
  583. local m = Instance.new("CylinderMesh")
  584. m.Scale = Vector3.new(0.23, 0.503, 0.23)
  585. m.Parent = p
  586. local w = Instance.new("Weld")
  587. w.Part0 = p
  588. w.Part1 = pv
  589. w.C0 = CFrame.new(0, -0.2, 0.38) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  590. w.C1 = CFrame.new()
  591. w.Parent = p
  592. else end
  593. local p = Instance.new("Part")
  594. p.Name = "RearSight"
  595. p.formFactor = "Symmetric"
  596. p.Size = Vector3.new(1, 1, 1)
  597. p.BrickColor = MC
  598. p.Reflectance = MR
  599. p.CanCollide = false
  600. p.Locked = true
  601. p.TopSurface = 0
  602. p.BottomSurface = 0
  603. p.Parent = model
  604. local m = Instance.new("BlockMesh")
  605. m.Scale = Vector3.new(0.1, 0.08, 0.08)
  606. m.Parent = p
  607. local w = Instance.new("Weld")
  608. w.Part0 = p
  609. w.Part1 = pv
  610. w.C0 = CFrame.new(0.44, 0.08, 0.28)
  611. w.C1 = CFrame.new()
  612. w.Parent = p
  613. local p = Instance.new("Part")
  614. p.Name = "RearSight"
  615. p.formFactor = "Symmetric"
  616. p.Size = Vector3.new(1, 1, 1)
  617. p.BrickColor = MC
  618. p.Reflectance = MR
  619. p.CanCollide = false
  620. p.Locked = true
  621. p.TopSurface = 0
  622. p.BottomSurface = 0
  623. p.Parent = model
  624. local m = Instance.new("BlockMesh")
  625. m.Scale = Vector3.new(0.1, 0.08, 0.08)
  626. m.Parent = p
  627. local w = Instance.new("Weld")
  628. w.Part0 = p
  629. w.Part1 = pv
  630. w.C0 = CFrame.new(0.44, -0.08, 0.28)
  631. w.C1 = CFrame.new()
  632. w.Parent = p
  633. local p = Instance.new("Part")
  634. p.Name = "FrontSight"
  635. p.formFactor = "Symmetric"
  636. p.Size = Vector3.new(1, 1, 1)
  637. p.BrickColor = MC
  638. p.Reflectance = MR
  639. p.CanCollide = false
  640. p.Locked = true
  641. p.TopSurface = 0
  642. p.BottomSurface = 0
  643. p.Parent = model
  644. local m = Instance.new("BlockMesh")
  645. m.Scale = Vector3.new(0.1, 0.08, 0.08)
  646. m.Parent = p
  647. local w = Instance.new("Weld")
  648. w.Part0 = p
  649. w.Part1 = pv
  650. w.C0 = CFrame.new(-0.58, 0, 0.28)
  651. w.C1 = CFrame.new()
  652. w.Parent = p
  653. local p = Instance.new("Part")
  654. p.Name = "Cylinder"
  655. p.formFactor = "Symmetric"
  656. p.Size = Vector3.new(1, 1, 1)
  657. p.BrickColor = MC
  658. p.Reflectance = MR
  659. p.CanCollide = false
  660. p.Locked = true
  661. p.TopSurface = 0
  662. p.BottomSurface = 0
  663. p.Parent = model
  664. local m = Instance.new("CylinderMesh")
  665. m.Scale = Vector3.new(0.29, 0.32, 0.29)
  666. m.Parent = p
  667. local w = Instance.new("Weld")
  668. w.Part0 = p
  669. w.Part1 = pv
  670. w.C0 = CFrame.new(0, 0.23, 0.1) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  671. w.C1 = CFrame.new()
  672. w.Parent = p
  673. local p = Instance.new("Part")
  674. p.Name = "Pin"
  675. p.formFactor = "Symmetric"
  676. p.Size = Vector3.new(1, 1, 1)
  677. p.BrickColor = BrickColor.new("New Yeller")
  678. p.Reflectance = MR
  679. p.CanCollide = false
  680. p.Locked = true
  681. p.TopSurface = 0
  682. p.BottomSurface = 0
  683. p.Parent = model
  684. local m = Instance.new("CylinderMesh")
  685. m.Scale = Vector3.new(0.06, 0.46, 0.06)
  686. m.Parent = p
  687. local w = Instance.new("Weld")
  688. w.Part0 = p
  689. w.Part1 = pv
  690. w.C0 = CFrame.new(0, 0.23, 0.1) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(90))
  691. w.C1 = CFrame.new()
  692. w.Parent = p
  693. local p = Instance.new("Part")
  694. if silenced == false then
  695. p.Name = "Muzzle"
  696. else
  697. p.Name = "Muzzle 2"
  698. end
  699. p.formFactor = "Symmetric"
  700. p.Size = Vector3.new(1, 1, 1)
  701. p.BrickColor = BrickColor.new("Lime green")
  702. p.Reflectance = 0.06
  703. p.CanCollide = false
  704. p.Transparency = 1
  705. p.Locked = true
  706. p.TopSurface = 0
  707. p.BottomSurface = 0
  708. p.Parent = model
  709. local m = Instance.new("CylinderMesh")
  710. m.Scale = Vector3.new(0.5, 0.1, 0.5)
  711. m.Offset = Vector3.new(0, 0, 0)
  712. m.Parent = p
  713. local w = Instance.new("Weld")
  714. w.Part0 = p
  715. w.Part1 = pv
  716. w.C0 = CFrame.new(0, 0.8, 0.18) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-90))
  717. w.C1 = CFrame.new()
  718. w.Parent = p
  719. local s = Instance.new("Smoke")
  720. s.Enabled = false
  721. s.Name = "Smoke"
  722. s.RiseVelocity = -5
  723. s.Opacity = 0.3
  724. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  725. s.Size = 1
  726. s.Parent = p
  727. local f = Instance.new("Fire")
  728. f.Enabled = false
  729. f.Name = "Fire"
  730. f.Heat = -35
  731. f.Size = 1
  732. f.Parent = p
  733. return model
  734. end
  735.  
  736.  
  737. function removeParts(format)
  738. if format == "RightHand" then
  739. pcall(function() Player.Character[Name]:Remove() end)
  740. elseif format == "LeftHand" then
  741. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  742. elseif format == "RightHolster" then
  743. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  744. elseif format == "LeftHolster" then
  745. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  746. end
  747. end
  748.  
  749.  
  750. function SetAngle(Joint, Angle, Character)
  751. if Character == nil then return false end
  752. local Joints = {
  753. Character.Torso:FindFirstChild("Right Shoulder 2"),
  754. Character.Torso:FindFirstChild("Left Shoulder 2"),
  755. Character.Torso:FindFirstChild("Right Hip 2"),
  756. Character.Torso:FindFirstChild("Left Hip 2")
  757. }
  758. if Joints[Joint] == nil then return false end
  759. if Joint == 1 or Joint == 3 then
  760. Joints[Joint].DesiredAngle = Angle
  761. end
  762. if Joint == 2 or Joint == 4 then
  763. Joints[Joint].DesiredAngle = -Angle
  764. end
  765. end
  766.  
  767.  
  768. function ForceAngle(Joint, Angle, Character)
  769. if Character == nil then return false end
  770. local Joints = {
  771. Character.Torso:FindFirstChild("Right Shoulder 2"),
  772. Character.Torso:FindFirstChild("Left Shoulder 2"),
  773. Character.Torso:FindFirstChild("Right Hip 2"),
  774. Character.Torso:FindFirstChild("Left Hip 2")
  775. }
  776. if Joints[Joint] == nil then return false end
  777. if Joint == 1 or Joint == 3 then
  778. Joints[Joint].DesiredAngle = Angle
  779. Joints[Joint].CurrentAngle = Angle
  780. end
  781. if Joint == 2 or Joint == 4 then
  782. Joints[Joint].DesiredAngle = -Angle
  783. Joints[Joint].CurrentAngle = -Angle
  784. end
  785. end
  786.  
  787.  
  788. function SetSpeed(Joint, Speed, Character)
  789. if Character == nil then return false end
  790. local Joints = {
  791. Character.Torso:FindFirstChild("Right Shoulder 2"),
  792. Character.Torso:FindFirstChild("Left Shoulder 2"),
  793. Character.Torso:FindFirstChild("Right Hip 2"),
  794. Character.Torso:FindFirstChild("Left Hip 2")
  795. }
  796. if Joints[Joint] == nil then return false end
  797. Joints[Joint].MaxVelocity = Speed
  798. end
  799.  
  800.  
  801. function DisableLimb(Limb, Character)
  802. if Character == nil then return false end
  803. if Character:FindFirstChild("Torso") == nil then return false end
  804. local Joints = {
  805. Character.Torso:FindFirstChild("Right Shoulder"),
  806. Character.Torso:FindFirstChild("Left Shoulder"),
  807. Character.Torso:FindFirstChild("Right Hip"),
  808. Character.Torso:FindFirstChild("Left Hip")
  809. }
  810. local Limbs = {
  811. Character:FindFirstChild("Right Arm"),
  812. Character:FindFirstChild("Left Arm"),
  813. Character:FindFirstChild("Right Leg"),
  814. Character:FindFirstChild("Left Leg")
  815. }
  816. if Joints[Limb] == nil then return false end
  817. if Limbs[Limb] == nil then return false end
  818. local Joint = Instance.new("Motor")
  819. Joint.Parent = Character.Torso
  820. Joint.Part0 = Character.Torso
  821. Joint.Part1 = Limbs[Limb]
  822. if Limb == 1 then
  823. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  824. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  825. Joint.Name = "Right Shoulder 2"
  826. elseif Limb == 2 then
  827. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  828. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  829. Joint.Name = "Left Shoulder 2"
  830. elseif Limb == 3 then
  831. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  832. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  833. Joint.Name = "Right Hip 2"
  834. elseif Limb == 4 then
  835. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  836. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  837. Joint.Name = "Left Hip 2"
  838. end
  839. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  840. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  841. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  842. Joints[Limb]:Remove()
  843. end
  844.  
  845.  
  846. function ResetLimbCFrame(Limb, Character)
  847. if Character == nil then return false end
  848. if Character.Parent == nil then return false end
  849. if Character:FindFirstChild("Torso") == nil then return false end
  850. local Joints = {
  851. Character.Torso:FindFirstChild("Right Shoulder 2"),
  852. Character.Torso:FindFirstChild("Left Shoulder 2"),
  853. Character.Torso:FindFirstChild("Right Hip 2"),
  854. Character.Torso:FindFirstChild("Left Hip 2")
  855. }
  856. local Limbs = {
  857. Character:FindFirstChild("Right Arm"),
  858. Character:FindFirstChild("Left Arm"),
  859. Character:FindFirstChild("Right Leg"),
  860. Character:FindFirstChild("Left Leg")
  861. }
  862. if Joints[Limb] == nil then return false end
  863. if Limbs[Limb] == nil then return false end
  864. if Limb == 1 then
  865. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  866. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  867. elseif Limb == 2 then
  868. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  869. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  870. elseif Limb == 3 then
  871. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  872. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  873. elseif Limb == 4 then
  874. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  875. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  876. end
  877. end
  878.  
  879.  
  880. function EnableLimb(Limb, Character)
  881. if Character == nil then return false end
  882. if Character:FindFirstChild("Torso") == nil then return false end
  883. local Joints = {
  884. Character.Torso:FindFirstChild("Right Shoulder 2"),
  885. Character.Torso:FindFirstChild("Left Shoulder 2"),
  886. Character.Torso:FindFirstChild("Right Hip 2"),
  887. Character.Torso:FindFirstChild("Left Hip 2")
  888. }
  889. local Limbs = {
  890. Character:FindFirstChild("Right Arm"),
  891. Character:FindFirstChild("Left Arm"),
  892. Character:FindFirstChild("Right Leg"),
  893. Character:FindFirstChild("Left Leg")
  894. }
  895. if Joints[Limb] == nil then return false end
  896. if Limbs[Limb] == nil then return false end
  897. if Limb == 1 then
  898. Joints[Limb].Name = "Right Shoulder"
  899. elseif Limb == 2 then
  900. Joints[Limb].Name = "Left Shoulder"
  901. elseif Limb == 3 then
  902. Joints[Limb].Name = "Right Hip"
  903. elseif Limb == 4 then
  904. Joints[Limb].Name = "Left Hip"
  905. end
  906. Animate = Character:FindFirstChild("Animate")
  907. if Animate == nil then return false end
  908. Animate = Animate:Clone()
  909. Character.Animate:Remove()
  910. Animate.Parent = Character
  911. end
  912.  
  913.  
  914. function playAnimation(format, mouse)
  915. if format == "equip" then
  916. Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  917. local w = Instance.new("Weld")
  918. w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  919. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  920. w.C0 = CFrame.new(0, 1.2, 0.7)
  921. w.C1 = CFrame.new()
  922. w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  923. for i = 0.01, 1, 0.1 do
  924. if Player.Character:FindFirstChild("Torso") ~= nil then
  925. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  926. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  927. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i)
  928. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  929. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  930. wait()
  931. else return false end
  932. else return false end
  933. end
  934. return playAnimation("hold")
  935. end
  936. if format == "rightEquip" then
  937. Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  938. local w = Instance.new("Weld")
  939. w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  940. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  941. w.C0 = CFrame.new(0, 1.2, 0.7)
  942. w.C1 = CFrame.new()
  943. w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  944. for i = 0.01, 1, 0.1 do
  945. if Player.Character:FindFirstChild("Torso") ~= nil then
  946. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  947. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  948. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  949. wait()
  950. else return false end
  951. else return false end
  952. end
  953. return playAnimation("rightHold")
  954. end
  955. if format == "leftEquip" then
  956. Player.Character[Name.. " (Holstered, Left)"].Handle.Weld:Remove()
  957. local w = Instance.new("Weld")
  958. w.Part0 = Player.Character[Name.. " (Holstered, Left)"].Handle
  959. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  960. w.C0 = CFrame.new(0, 1.2, 0.7)
  961. w.C1 = CFrame.new()
  962. w.Parent = Player.Character[Name.. " (Holstered, Left)"].Handle
  963. for i = 0.01, 1, 0.1 do
  964. if Player.Character:FindFirstChild("Torso") ~= nil then
  965. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  966. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  967. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0)
  968. wait()
  969. else return false end
  970. else return false end
  971. end
  972. return playAnimation("leftHold")
  973. end
  974. if format == "unequip" then
  975. for i = 1, 0.01, -0.1 do
  976. if Player.Character:FindFirstChild("Torso") ~= nil then
  977. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  978. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  979. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.55 * i) + (1.5 * (1 - i)), 0.75 * i, 0.35 * i) * CFrame.fromEulerAnglesXYZ(math.rad(315 + ((1 - i) * 50)), 0, math.rad(-90) * i)
  980. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  981. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  982. wait()
  983. else return false end
  984. else return false end
  985. end
  986. return true
  987. end
  988. if format == "leftUnequip" then
  989. for i = 1, 0.01, -0.1 do
  990. if Player.Character:FindFirstChild("Torso") ~= nil then
  991. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  992. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  993. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((1 * i) + (1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(5 * i), 0)
  994. wait()
  995. else return false end
  996. else return false end
  997. end
  998. return true
  999. end
  1000. if format == "rightUnequip" then
  1001. for i = 1, 0.01, -0.1 do
  1002. if Player.Character:FindFirstChild("Torso") ~= nil then
  1003. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1004. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1005. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-1 * i) + (-1.5 * (1 - i)), 0.5 * i, 0.6 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  1006. wait()
  1007. else return false end
  1008. else return false end
  1009. end
  1010. return true
  1011. end
  1012. if format == "hold" then
  1013. if Player.Character:FindFirstChild("Torso") ~= nil then
  1014. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1015. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1016. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), 0, math.rad(-90))
  1017. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1018. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1019. else return false end
  1020. else return false end
  1021. end
  1022. if format == "rightHold" then
  1023. if Player.Character:FindFirstChild("Torso") ~= nil then
  1024. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1025. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1026. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(-10))
  1027. else return false end
  1028. else return false end
  1029. end
  1030. if format == "leftHold" then
  1031. if Player.Character:FindFirstChild("Torso") ~= nil then
  1032. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  1033. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1034. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, math.rad(10))
  1035. else return false end
  1036. else return false end
  1037. end
  1038. if format == "reload" then
  1039. Player.Character[Name].Handle.Empty:Play()
  1040. for i = 0, 25, 7.5 do
  1041. if Player.Character:FindFirstChild("Torso") ~= nil then
  1042. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1043. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1044. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1045. wait()
  1046. else return false end
  1047. else return false end
  1048. end
  1049. for i = 25, 0, -7.5 do
  1050. if Player.Character:FindFirstChild("Torso") ~= nil then
  1051. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1052. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1053. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1054. wait()
  1055. else return false end
  1056. else return false end
  1057. end
  1058. coroutine.wrap(function()
  1059. for i = 0, 90, 15 do
  1060. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) end)
  1061. wait()
  1062. end
  1063. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) end)
  1064. for i = 1, Loaded do
  1065. Player.Character[Name].Handle.Switch:Play()
  1066. makeShell(Player.Character[Name]:FindFirstChild("Cylinder"))
  1067. Loaded = Loaded - 1
  1068. if magazine.Value ~= 0 then
  1069. magazine.Value = magazine.Value - 1
  1070. updateGui()
  1071. end
  1072. wait(0.02)
  1073. end
  1074. end)()
  1075. CamShake(15, 50000)
  1076. Player.Character[Name].Handle.Release:Play()
  1077. --[[for i = 25, 0, -5 do
  1078. if Player.Character:FindFirstChild("Torso") ~= nil then
  1079. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1080. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1081. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + ((25 - i) / 30), 0.5, 0.6 + ((25 - i) / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), math.rad((25 * 2) - (i * 2)))
  1082. wait()
  1083. else return false end
  1084. else return false end
  1085. end
  1086. for i = 25, 0, -5 do
  1087. if Player.Character:FindFirstChild("Torso") ~= nil then
  1088. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1089. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1090. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + (i / 30), 0.5, 0.6 + (i / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad((25 * 2) - ((25 - i) * 2)))
  1091. wait()
  1092. else return false end
  1093. else return false end
  1094. end
  1095. wait(0.18)--]]
  1096. for i = 0, 35, 5 do
  1097. if Player.Character:FindFirstChild("Torso") ~= nil then
  1098. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1099. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1100. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, -0.4, 0.3) * CFrame.fromEulerAnglesXYZ(math.rad(-90 + i), math.rad(-5), 0)
  1101. wait()
  1102. else return false end
  1103. else return false end
  1104. end
  1105. wait(0.2)
  1106. if ammo.Value >= 6 then
  1107. for i = 1, 6 do
  1108. for i = 5, 0, -1 do
  1109. if Player.Character:FindFirstChild("Torso") ~= nil then
  1110. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1111. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1112. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.85, 0.84) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1113. wait()
  1114. else return false end
  1115. else return false end
  1116. end
  1117. Player.Character[Name].Handle.Reload:Play()
  1118. ammo.Value = ammo.Value - 1
  1119. magazine.Value = magazine.Value + 1
  1120. Loaded = Loaded + 1
  1121. updateGui()
  1122. wait(0.1)
  1123. end
  1124. elseif ammo.Value <= 6 then
  1125. for i = 1, ammo.Value do
  1126. for i = 5, 0, -1 do
  1127. if Player.Character:FindFirstChild("Torso") ~= nil then
  1128. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1129. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1130. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.85, 0.84) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1131. wait()
  1132. else return false end
  1133. else return false end
  1134. end
  1135. Player.Character[Name].Handle.Reload:Play()
  1136. ammo.Value = ammo.Value - 1
  1137. magazine.Value = magazine.Value + 1
  1138. Loaded = Loaded + 1
  1139. updateGui()
  1140. wait(0.1)
  1141. end
  1142. else end
  1143. wait(0.04)
  1144. coroutine.wrap(function()
  1145. for i = 1, 0, -0.25 do
  1146. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i * 90), 0) end)
  1147. wait()
  1148. end
  1149. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0) end)
  1150. end)()
  1151. CamShake(15, 50000)
  1152. Player.Character[Name].Handle.Release:Play()
  1153. for i = 0, 25, 7.5 do
  1154. if Player.Character:FindFirstChild("Torso") ~= nil then
  1155. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1156. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1157. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1158. wait()
  1159. else return false end
  1160. else return false end
  1161. end
  1162. for i = 25, 0, -7.5 do
  1163. if Player.Character:FindFirstChild("Torso") ~= nil then
  1164. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1165. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1166. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1167. wait()
  1168. else return false end
  1169. else return false end
  1170. end
  1171. playAnimation("hold")
  1172. return true
  1173. end
  1174. if format == "reloadDual" then
  1175. for i = 0, 25, 7.5 do
  1176. if Player.Character:FindFirstChild("Torso") ~= nil then
  1177. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1178. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1179. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
  1180. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1181. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1182. wait()
  1183. else return false end
  1184. else return false end
  1185. end
  1186. CamShake(1, 40000)
  1187. Player.Character[Name].Handle.Release:Play()
  1188. coroutine.wrap(function()
  1189. for i = 0, 90, 15 do
  1190. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) end)
  1191. pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i), 0) end)
  1192. wait()
  1193. end
  1194. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) end)
  1195. pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) end)
  1196. end)()
  1197. for i = 0, 25, 7.5 do
  1198. if Player.Character:FindFirstChild("Torso") ~= nil then
  1199. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1200. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1201. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
  1202. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1203. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1204. wait()
  1205. else return false end
  1206. else return false end
  1207. end
  1208. for i = 125, 0, -15 do
  1209. if Player.Character:FindFirstChild("Torso") ~= nil then
  1210. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1211. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1212. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0)
  1213. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1214. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0)
  1215. wait()
  1216. else return false end
  1217. else return false end
  1218. end
  1219. for i = 1, 6 do
  1220. Player.Character[Name].Handle.Switch:Play()
  1221. makeShell(Player.Character[Name]:FindFirstChild("Cylinder"))
  1222. makeShell(Player.Character[Name.. " (Left)"]:FindFirstChild("Cylinder"))
  1223. wait(0.04)
  1224. end
  1225. magazine.Value = 0
  1226. Player.Character[Name].Handle.Reload:Play()
  1227. for i = 0, 125, 15 do
  1228. if Player.Character:FindFirstChild("Torso") ~= nil then
  1229. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1230. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1231. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(5), 0)
  1232. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1233. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad((-90 - i) + 100), math.rad(-5), 0)
  1234. wait()
  1235. else return false end
  1236. else return false end
  1237. end
  1238. coroutine.wrap(function()
  1239. for i = 1, 0, -0.25 do
  1240. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i * 90), 0) end)
  1241. pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(i * 90), 0) end)
  1242. wait()
  1243. end
  1244. pcall(function() Player.Character[Name].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0) end)
  1245. pcall(function() Player.Character[Name.. " (Left)"].Pivot.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(0), 0) end)
  1246. end)()
  1247. Player.Character[Name].Handle.Release:Play()
  1248. for i = 25, 0, -5 do
  1249. if Player.Character:FindFirstChild("Torso") ~= nil then
  1250. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1251. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1252. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(5), 0)
  1253. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1254. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1255. wait()
  1256. else return false end
  1257. else return false end
  1258. end
  1259. end
  1260. if format == "hammer" then
  1261. Player.Character[Name].Handle.Reload:Play()
  1262. for i = 25, 0, -5 do
  1263. if Player.Character:FindFirstChild("Torso") ~= nil then
  1264. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1265. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1266. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + (i / 30), 0.5, 0.6 + (i / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad((25 * 2) - ((25 - i) * 2)))
  1267. wait()
  1268. else return false end
  1269. else return false end
  1270. end
  1271. Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0)
  1272. end
  1273. if format == "fire" then
  1274. coroutine.resume(coroutine.create(function()
  1275. if Hammer == false then
  1276. Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0)
  1277. wait(0.04)
  1278. Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0)
  1279. else
  1280. Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0)
  1281. Hammer = false
  1282. end
  1283. end))
  1284. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1285. if silenced then
  1286. Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10
  1287. Player.Character[Name].Handle.Fire.Pitch = math.random(35, 40) / 15
  1288. Player.Character[Name].Handle.Fire:Play()
  1289. CamShake(15, 50000)
  1290. else
  1291. Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10
  1292. Player.Character[Name].Handle.Fire.Pitch = math.random(25, 35) / 20
  1293. Player.Character[Name].Handle.Fire:Play()
  1294. CamShake(15, 50000)
  1295. end
  1296. else return false end
  1297. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  1298. if silenced == false then
  1299. coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  1300. else end
  1301. else return false end
  1302. for i = 0, 10, 5 do
  1303. if Player.Character:FindFirstChild("Torso") ~= nil then
  1304. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1305. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1306. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90))
  1307. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1308. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1309. wait()
  1310. else return false end
  1311. else return false end
  1312. end
  1313. for i = 10, 0, -5 do
  1314. if Player.Character:FindFirstChild("Torso") ~= nil then
  1315. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1316. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1317. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315), math.rad(i), math.rad(-90))
  1318. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1319. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), math.rad(-5), 0)
  1320. wait()
  1321. else return false end
  1322. else return false end
  1323. end
  1324. end
  1325. if format == "rightFire" then
  1326. coroutine.resume(coroutine.create(function()
  1327. if Hammer == false then
  1328. Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0)
  1329. wait(0.04)
  1330. Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0)
  1331. else
  1332. Player.Character[Name].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0)
  1333. Hammer = false
  1334. end
  1335. end))
  1336. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1337. if silenced then
  1338. Player.Character[Name].Handle.Fire.Volume = math.random(3, 8) / 10
  1339. Player.Character[Name].Handle.Fire.Pitch = math.random(35, 40) / 15
  1340. Player.Character[Name].Handle.Fire:Play()
  1341. CamShake(15, 50000)
  1342. else
  1343. Player.Character[Name].Handle.Fire.Volume = math.random(8, 12) / 10
  1344. Player.Character[Name].Handle.Fire.Pitch = math.random(25, 35) / 20
  1345. Player.Character[Name].Handle.Fire:Play()
  1346. CamShake(15, 50000)
  1347. end
  1348. else return false end
  1349. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  1350. if silenced == false then
  1351. coroutine.resume(coroutine.create(function() Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  1352. else end
  1353. else return false end
  1354. for i = 0, 10, 5 do
  1355. if Player.Character:FindFirstChild("Torso") ~= nil then
  1356. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1357. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1358. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(-10))
  1359. wait()
  1360. else return false end
  1361. else return false end
  1362. end
  1363. for i = 10, 0, -5 do
  1364. if Player.Character:FindFirstChild("Torso") ~= nil then
  1365. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1366. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1367. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(-10))
  1368. wait()
  1369. else return false end
  1370. else return false end
  1371. end
  1372. end
  1373. if format == "leftFire" then
  1374. coroutine.resume(coroutine.create(function()
  1375. if Hammer == false then
  1376. Player.Character[Name.. "(Left)"].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.1) * CFrame.fromEulerAnglesXYZ(math.rad(-35), 0, 0)
  1377. wait(0.04)
  1378. Player.Character[Name.. "(Left)"].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0)
  1379. else
  1380. Player.Character[Name.. "(Left)"].Hammer.Weld.C0 = CFrame.new(0, -0.1, 0.08) * CFrame.fromEulerAnglesXYZ(math.rad(0), 0, 0)
  1381. Hammer = false
  1382. end
  1383. end))
  1384. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") ~= nil then
  1385. if silenced then
  1386. Player.Character[Name.. " (Left)"].Handle.Fire.Volume = math.random(3, 8) / 10
  1387. Player.Character[Name.. " (Left)"].Handle.Fire.Pitch = math.random(25, 40) / 15
  1388. Player.Character[Name.. " (Left)"].Handle.Fire:Play()
  1389. CamShake(15, 50000)
  1390. else
  1391. Player.Character[Name.. " (Left)"].Handle.Fire.Volume = math.random(8, 12) / 10
  1392. Player.Character[Name.. " (Left)"].Handle.Fire.Pitch = math.random(25, 35) / 20
  1393. Player.Character[Name.. " (Left)"].Handle.Fire:Play()
  1394. CamShake(15, 50000)
  1395. end
  1396. end
  1397. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") ~= nil then
  1398. if silenced == false then
  1399. coroutine.resume(coroutine.create(function() Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = true Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name.. " (Left)"].Muzzle.Smoke.Enabled = false Player.Character[Name.. " (Left)"].Muzzle.Fire.Enabled = false end))
  1400. else end
  1401. end
  1402. for i = 0, 10, 5 do
  1403. if Player.Character:FindFirstChild("Torso") ~= nil then
  1404. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1405. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1406. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(10))
  1407. wait()
  1408. else return false end
  1409. else return false end
  1410. end
  1411. for i = 10, 0, -5 do
  1412. if Player.Character:FindFirstChild("Torso") ~= nil then
  1413. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1414. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1415. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0.7, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-90 - i), 0, math.rad(10))
  1416. wait()
  1417. else return false end
  1418. else return false end
  1419. end
  1420. end
  1421. return true
  1422. end
  1423.  
  1424.  
  1425. function CamShake(time, freq)
  1426. coroutine.resume(coroutine.create(function()
  1427. local cam = game:GetService("Workspace").CurrentCamera
  1428. local time = 10
  1429. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  1430. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  1431. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  1432. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(seed.x * time, seed.y * time, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1433. for i = 1, time do
  1434. cam.CoordinateFrame = (CFrame.new(cam.Focus.p) * (cam.CoordinateFrame - cam.CoordinateFrame.p) * CFrame.fromEulerAnglesXYZ(-seed.x, -seed.y, 0)) * CFrame.new(0, 0, (cam.CoordinateFrame.p - cam.Focus.p).magnitude)
  1435. wait()
  1436. end
  1437. end))
  1438. end
  1439.  
  1440.  
  1441. function makeShell(part)
  1442. if part == nil then return false end
  1443. local casing = Instance.new("Part")
  1444. casing.Name = "Shell"
  1445. casing.formFactor = "Custom"
  1446. casing.Size = Vector3.new(0.2, 0.26, 0.2)
  1447. casing.CFrame = CFrame.new(part.Position) * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  1448. casing.BrickColor = BrickColor.new("New Yeller")
  1449. local mesh = Instance.new("CylinderMesh")
  1450. mesh.Scale = Vector3.new(0.4, 1, 0.4)
  1451. mesh.Parent = casing
  1452. casing.Parent = game:GetService("Workspace")
  1453. casing:BreakJoints()
  1454. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  1455. end
  1456.  
  1457.  
  1458. function Weld(x, y)
  1459. local weld = Instance.new("Weld")
  1460. weld.Part0 = x
  1461. weld.Part1 = y
  1462. CJ = CFrame.new(x.Position)
  1463. C0 = x.CFrame:inverse() * CJ
  1464. C1 = y.CFrame:inverse() * CJ
  1465. weld.C0 = C0
  1466. weld.C1 = C1
  1467. weld.Parent = x
  1468. end
  1469.  
  1470.  
  1471. function tagHumanoid(humanoid)
  1472. local tag = Instance.new("ObjectValue")
  1473. tag.Name = "creator"
  1474. tag.Value = Player
  1475. tag.Parent = humanoid
  1476. local tag = Instance.new("StringValue")
  1477. tag.Name = "creatorType1"
  1478. tag.Value = Name
  1479. tag.Parent = humanoid
  1480. local tag = Instance.new("StringValue")
  1481. tag.Name = "creatorType2"
  1482. tag.Value = "shot"
  1483. tag.Parent = humanoid
  1484. end
  1485.  
  1486.  
  1487. function untagHumanoid(humanoid)
  1488. if humanoid ~= nil then
  1489. local tag = humanoid:FindFirstChild("creator")
  1490. if tag ~= nil then
  1491. tag:Remove()
  1492. end
  1493. local tag = humanoid:FindFirstChild("creatorType1")
  1494. if tag ~= nil then
  1495. tag:Remove()
  1496. end
  1497. local tag = humanoid:FindFirstChild("creatorType2")
  1498. if tag ~= nil then
  1499. tag:Remove()
  1500. end
  1501. end
  1502. end
  1503.  
  1504.  
  1505. function fire(startPoint, endPoint, hit)
  1506. local trail = Instance.new("Part")
  1507. trail.Name = "Bullet Trail"
  1508. trail.BrickColor = BrickColor.new("New Yeller")
  1509. trail.TopSurface = 0
  1510. trail.BottomSurface = 0
  1511. trail.formFactor = 0
  1512. trail.Size = Vector3.new(1, 1, 1)
  1513. trail.Transparency = 0.5
  1514. trail.Anchored = true
  1515. trail.CanCollide = false
  1516. trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  1517. trail.Parent = game:GetService("Workspace")
  1518. local mesh = Instance.new("SpecialMesh")
  1519. mesh.MeshType = "Brick"
  1520. mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
  1521. mesh.Parent = trail
  1522. coroutine.resume(coroutine.create(function(part) for i = 1, 10 do part.Mesh.Scale = Vector3.new(part.Mesh.Scale.x - 0.01, part.Mesh.Scale.y - 0.01, part.Mesh.Scale.z) wait() end part:Remove() end), trail)
  1523. if hit ~= nil then
  1524. if hit.Parent == nil then return end
  1525. if hit.Parent.ClassName == "Hat" then
  1526. if hit.Parent.Parent.Humanoid ~= nil then
  1527. hit.Parent.Parent.Humanoid:TakeDamage(damage * 5)
  1528. end
  1529. end
  1530. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1531. tagHumanoid(hit.Parent.Humanoid)
  1532. if hit.Name == "Head" then
  1533. hit.Parent.Humanoid:TakeDamage(damage * 10)
  1534. elseif hit.Name == "Torso" then
  1535. hit.Parent.Humanoid:TakeDamage(damage * 2)
  1536. elseif hit.Name == "Left Leg" then
  1537. hit.Parent.Humanoid:TakeDamage(damage)
  1538. hit.Parent.Humanoid.Sit = false
  1539. elseif hit.Name == "Right Leg" then
  1540. hit.Parent.Humanoid:TakeDamage(damage)
  1541. hit.Parent.Humanoid.Sit = false
  1542. else
  1543. hit.Parent.Humanoid:TakeDamage(damage)
  1544. end
  1545. if math.random(1, 10) == 1 then
  1546. hit.Parent.Humanoid.Sit = false
  1547. end
  1548. delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  1549. end
  1550. if hit.Anchored == false then
  1551. hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
  1552. end
  1553. end
  1554. end
  1555.  
  1556.  
  1557. function onButton1Down(mouse)
  1558. if selected == false then return end
  1559. if Player.Character:FindFirstChild(Name) ~= nil and Button1Down == false and canFire == true and (function() if dual == true then if Player.Character:FindFirstChild(Name.. " (Left)") ~= nil then return true else return false end else return true end end)() == true then
  1560. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1561. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1562. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1563. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1564. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1565. Button1Down = true
  1566. canFire = false
  1567. canFire2 = true
  1568. while canFire2 == true do
  1569. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1570. if humanoid == nil then
  1571. canFire2 = false
  1572. break
  1573. end
  1574. if humanoid.Health <= 0 then
  1575. canFire2 = false
  1576. break
  1577. end
  1578. local fireLeft = false
  1579. if automatic == false and burst == false then
  1580. canFire2 = false
  1581. elseif automatic == false and burst == true then
  1582. if burstCount >= burstCountMax then
  1583. canFire2 = false
  1584. burstCount = 0
  1585. break
  1586. end
  1587. burstCount = burstCount + 1
  1588. elseif automatic == true and burst == false then
  1589. fireLeft = true
  1590. end
  1591. if magazine.Value > 0 then
  1592. magazine.Value = magazine.Value - Chamber
  1593. updateGui()
  1594. if silenced == true then
  1595. CamShake(1, Spread)
  1596. else end
  1597. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1598. coroutine.resume(coroutine.create(function()
  1599. if dual == true then
  1600. playAnimation("rightFire")
  1601. elseif dual == false then
  1602. playAnimation("fire")
  1603. end
  1604. end))
  1605. if dual == true then
  1606. wait(math.random(0, 0.15))
  1607. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1608. coroutine.resume(coroutine.create(function()
  1609. playAnimation("leftFire")
  1610. end))
  1611. end
  1612. else
  1613. Player.Character[Name].Handle.Empty:Play()
  1614. end
  1615. if fireLeft == true and dual == true and automatic == true then
  1616. if magazine.Value > 0 then
  1617. coroutine.resume(coroutine.create(function()
  1618. wait(readyTime / 2)
  1619. magazine.Value = magazine.Value - 1
  1620. updateGui()
  1621. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1622. if silenced == true then
  1623. CamShake(1, Spread)
  1624. else end
  1625. playAnimation("leftFire")
  1626. end))
  1627. else
  1628. coroutine.resume(coroutine.create(function()
  1629. wait(readyTime / 2)
  1630. Player.Character[Name].Handle.Empty:Play()
  1631. end))
  1632. end
  1633. end
  1634. wait(readyTime)
  1635. end
  1636. if magazine.Value ~= 0 then
  1637. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1638. else end
  1639. canFire = true
  1640. end
  1641. end
  1642.  
  1643.  
  1644. function onButton1Up(mouse)
  1645. if selected == false then return end
  1646. Button1Down = false
  1647. canFire2 = false
  1648. burstCount = 0
  1649. while canFire == false do wait() end
  1650. if dual == true and automatic == false then
  1651. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1652. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1653. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1654. canFire = false
  1655. canFire2 = true
  1656. while canFire2 == true do
  1657. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1658. if humanoid == nil then
  1659. canFire2 = false
  1660. break
  1661. end
  1662. if humanoid.Health <= 0 then
  1663. canFire2 = false
  1664. break
  1665. end
  1666. if burst == false then
  1667. canFire2 = false
  1668. elseif burst == true then
  1669. if burstCount >= burstCountMax then
  1670. canFire2 = false
  1671. burstCount = 0
  1672. break
  1673. end
  1674. burstCount = burstCount + 1
  1675. end
  1676. if magazine.Value <= 0 then
  1677. Player.Character[Name].Handle.Empty:Play()
  1678. else end
  1679. end
  1680. if magazine.Value ~= 0 then
  1681. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1682. else end
  1683. canFire = true
  1684. end
  1685. end
  1686.  
  1687.  
  1688. function onKeyDown(key, mouse)
  1689. if selected == false then return end
  1690. key = key:lower()
  1691. if key == "q" and Button1Down == false and canFire == true then
  1692. if mouse.Target == nil then return end
  1693. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1694. if dual == true then onKeyDown("t", mouse) end
  1695. onDeselected(mouse)
  1696. removeParts("RightHolster")
  1697. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1698. end
  1699. end
  1700. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1701. if silenced then
  1702. silenced = false
  1703. Player.Character[Name].Handle.Lock.Pitch = 5
  1704. Player.Character[Name].Handle.Lock:Play()
  1705. if Player.Character:FindFirstChild(Name) == nil then return end
  1706. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1707. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1708. Player.Character[Name].Muzzle.Transparency = 1
  1709. Player.Character[Name].Muzzle.Name = "Silencer"
  1710. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1711. if dual == true then
  1712. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1713. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1714. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1715. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1716. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1717. end
  1718. else
  1719. silenced = true
  1720. Player.Character[Name].Handle.Lock.Pitch = 5
  1721. Player.Character[Name].Handle.Lock:Play()
  1722. if Player.Character:FindFirstChild(Name) == nil then return end
  1723. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1724. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1725. Player.Character[Name].Silencer.Transparency = 0
  1726. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1727. Player.Character[Name].Silencer.Name = "Muzzle"
  1728. if dual == true then
  1729. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1730. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1731. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1732. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1733. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1734. end
  1735. end
  1736. end
  1737. if key == "r" and Button1Down == false and canFire == true then
  1738. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1739. canFire = false
  1740. burstCount = 0
  1741. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1742. updateGui()
  1743. if dual == true then
  1744. playAnimation("reloadDual")
  1745. elseif dual == false then
  1746. playAnimation("reload")
  1747. end
  1748. if dual == true then
  1749. if ammo.Value - magazineMax.Value < 0 then
  1750. magazine.Value = ammo.Value
  1751. ammo.Value = 0
  1752. elseif ammo.Value - magazineMax.Value >= 0 then
  1753. ammo.Value = ammo.Value - magazineMax.Value
  1754. magazine.Value = magazine.Value + magazineMax.Value
  1755. end
  1756. else end
  1757. updateGui()
  1758. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1759. canFire = true
  1760. end
  1761. end
  1762. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1763. canFire = false
  1764. if dual == false then
  1765. local weapon = nil
  1766. for _, p in pairs(Player.Backpack:GetChildren()) do
  1767. if p.Name == Name and p ~= script.Parent then weapon = p break end
  1768. end
  1769. if weapon ~= nil then
  1770. dual = true
  1771. Chamber = 2
  1772. weapon.Name = "Dual"
  1773. weapon.Parent = script
  1774. removeParts("RightHand")
  1775. makeParts("RightHand")
  1776. removeParts("RightHolster")
  1777. makeParts("LeftHolster")
  1778. playAnimation("leftEquip")
  1779. removeParts("LeftHolster")
  1780. makeParts("LeftHand")
  1781. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1782. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1783. magazine.Value = magazine.Value + weapon.Magazine.Value
  1784. ammo.Value = ammo.Value + weapon.Ammo.Value
  1785. updateGui()
  1786. end
  1787. elseif dual == true then
  1788. local weapon = script:FindFirstChild("Dual")
  1789. if weapon ~= nil then
  1790. dual = false
  1791. Chamber = 1
  1792. weapon.Name = Name
  1793. weapon.Parent = Player.Backpack
  1794. removeParts("RightHand")
  1795. makeParts("RightHand")
  1796. playAnimation("leftUnequip")
  1797. removeParts("LeftHand")
  1798. makeParts("RightHolster")
  1799. playAnimation("hold")
  1800. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1801. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1802. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1803. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1804. magazine.Value = math.ceil(magazine.Value / 2)
  1805. ammo.Value = math.ceil(ammo.Value / 2)
  1806. updateGui()
  1807. end
  1808. end
  1809. canFire = true
  1810. end
  1811. if key == "y" and canZoom == true then
  1812. if zoom == false then
  1813. zoom = true
  1814. local pos = mouse.Hit.p
  1815. local target = mouse.Target
  1816. local cam = game:GetService("Workspace").CurrentCamera
  1817. focus = Instance.new("Part", workspace)
  1818. focus.Anchored = true
  1819. focus.CanCollide = false
  1820. focus.Transparency = 1
  1821. focus.TopSurface = 0
  1822. focus.BottomSurface = 0
  1823. focus.formFactor = "Plate"
  1824. focus.Size = Vector3.new(0, 0, 0)
  1825. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1826. cam.CameraSubject = focus
  1827. cam.CameraType = "Attach"
  1828. while zoom == true and selected == true do
  1829. local set = false
  1830. if target ~= nil then
  1831. if target.Parent ~= nil then
  1832. if target.Anchored == false then
  1833. focus.CFrame = CFrame.new(target.CFrame.p) * (CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p) - CFrame.new(Player.Character.Torso.CFrame.p, target.CFrame.p).p)
  1834. set = true
  1835. end
  1836. end
  1837. end
  1838. if set == false then
  1839. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1840. end
  1841. wait()
  1842. end
  1843. if focus ~= nil then focus:Remove() focus = nil end
  1844. local cam = game:GetService("Workspace").CurrentCamera
  1845. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1846. cam.CameraType = "Custom"
  1847. else
  1848. zoom = false
  1849. end
  1850. end
  1851. if key == "u" and Button1Down == false and canFire == true then
  1852. if automatic == false and burst == false then
  1853. if switchToBurst == true then
  1854. burst = true
  1855. local m = Instance.new("Message", Player)
  1856. m.Text = "Burst"
  1857. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1858. delay(2.5, function() m:Remove() end)
  1859. elseif switchToAutomatic == true then
  1860. automatic = true
  1861. local m = Instance.new("Message", Player)
  1862. m.Text = "Automatic"
  1863. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1864. delay(2.5, function() m:Remove() end)
  1865. end
  1866. elseif automatic == false and burst == true then
  1867. if switchToAutomatic == true then
  1868. automatic = true
  1869. burst = false
  1870. local m = Instance.new("Message", Player)
  1871. m.Text = "Automatic"
  1872. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1873. delay(2.5, function() m:Remove() end)
  1874. elseif switchToSingle == true then
  1875. burst = false
  1876. local m = Instance.new("Message", Player)
  1877. m.Text = "Single"
  1878. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1879. delay(2.5, function() m:Remove() end)
  1880. end
  1881. elseif automatic == true and burst == false then
  1882. if switchToSingle == true then
  1883. automatic = false
  1884. local m = Instance.new("Message", Player)
  1885. m.Text = "Single"
  1886. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1887. delay(2.5, function() m:Remove() end)
  1888. elseif switchToBurst == true then
  1889. automatic = false
  1890. burst = true
  1891. local m = Instance.new("Message", Player)
  1892. m.Text = "Burst"
  1893. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1894. delay(2.5, function() m:Remove() end)
  1895. end
  1896. end
  1897. end
  1898. if key == "c" and Hammer == false and dual == false and canFire == true then
  1899. playAnimation("hammer")
  1900. Hammer = true
  1901. end
  1902. end
  1903.  
  1904.  
  1905. function onSelected(mouse)
  1906. if selected == true then return end
  1907. selected = true
  1908. canFire = false
  1909. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1910. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1911. if Player.Character.WeaponActivated.Value == nil then break end
  1912. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1913. wait()
  1914. end
  1915. updateGui()
  1916. local weapon = Instance.new("ObjectValue")
  1917. weapon.Name = "WeaponActivated"
  1918. weapon.Value = script.Parent
  1919. weapon.Parent = Player.Character
  1920. DisableLimb(1, Player.Character)
  1921. DisableLimb(2, Player.Character)
  1922. ForceAngle(1, 0, Player.Character)
  1923. ForceAngle(2, 0, Player.Character)
  1924. if dual == true then
  1925. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1926. playAnimation("rightEquip")
  1927. removeParts("LeftHolster")
  1928. makeParts("LeftHand")
  1929. else
  1930. playAnimation("equip")
  1931. end
  1932. removeParts("RightHolster")
  1933. makeParts("RightHand")
  1934. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1935. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1936. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1937. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1938. canFire = true
  1939. end
  1940.  
  1941.  
  1942. function onDeselected(mouse)
  1943. if selected == false then return end
  1944. Button1Down = false
  1945. while canFire == false do
  1946. wait()
  1947. end
  1948. selected = false
  1949. if dual == true then
  1950. if math.random(1, 2) == 1 then
  1951. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1952. wait(math.random(1, 10) / 10)
  1953. playAnimation("rightUnequip")
  1954. else
  1955. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1956. wait(math.random(1, 10) / 10)
  1957. playAnimation("leftUnequip")
  1958. end
  1959. removeParts("LeftHand")
  1960. makeParts("LeftHolster")
  1961. else
  1962. playAnimation("unequip")
  1963. end
  1964. removeParts("RightHand")
  1965. makeParts("RightHolster")
  1966. ForceAngle(1, 0, Player.Character)
  1967. ForceAngle(2, 0, Player.Character)
  1968. ResetLimbCFrame(1, Player.Character)
  1969. ResetLimbCFrame(2, Player.Character)
  1970. EnableLimb(1, Player.Character)
  1971. EnableLimb(2, Player.Character)
  1972. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1973. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1974. if Player.Character.WeaponActivated.Value == script.Parent then
  1975. Player.Character.WeaponActivated:Remove()
  1976. end
  1977. end
  1978. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1979. if Player.Character.WeaponActivated.Value == nil then break end
  1980. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1981. wait()
  1982. end
  1983. end
  1984.  
  1985.  
  1986. if script.Parent.className ~= "HopperBin" then
  1987. if Player == nil then print("Error: Player not found!") return end
  1988. Tool = Instance.new("HopperBin")
  1989. Tool.Name = Name
  1990. Tool.Parent = Player.Backpack
  1991. script.Name = "Main"
  1992. script.Parent = Tool
  1993. elseif script.Parent.className == "HopperBin" then
  1994. while script.Parent.Parent.className ~= "Backpack" do
  1995. wait()
  1996. end
  1997. if script.Parent:FindFirstChild("MagazineMax") == nil then
  1998. magazineMax = Instance.new("NumberValue")
  1999. magazineMax.Name = "MagazineMax"
  2000. magazineMax.Value = 1333333333333333337
  2001. magazineMax.Parent = script.Parent
  2002. else
  2003. magazineMax = script.Parent.MagazineMax
  2004. end
  2005. if script.Parent:FindFirstChild("Magazine") == nil then
  2006. magazine = Instance.new("NumberValue")
  2007. magazine.Name = "Magazine"
  2008. magazine.Value = 133333333333333333337
  2009. magazine.Parent = script.Parent
  2010. else
  2011. magazine = script.Parent.Magazine
  2012. end
  2013. if script.Parent:FindFirstChild("AmmoMax") == nil then
  2014. ammoMax = Instance.new("NumberValue")
  2015. ammoMax.Name = "AmmoMax"
  2016. ammoMax.Value = 133333333333333333333333333333333333333333333333333333333337
  2017. ammoMax.Parent = script.Parent
  2018. else
  2019. ammoMax = script.Parent.AmmoMax
  2020. end
  2021. if script.Parent:FindFirstChild("Ammo") == nil then
  2022. ammo = Instance.new("NumberValue")
  2023. ammo.Name = "Ammo"
  2024. ammo.Value = script.Parent.AmmoMax.Value
  2025. ammo.Parent = script.Parent
  2026. else
  2027. ammo = script.Parent.Ammo
  2028. end
  2029. Player = script.Parent.Parent.Parent
  2030. makeParts("RightHolster")
  2031. script.Parent.Selected:connect(onSelected)
  2032. script.Parent.Deselected:connect(onDeselected)
  2033. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement