Axtem

M249

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