Sergeant_SethZP

m4

Mar 3rd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 93.87 KB | None | 0 0
  1. --[[
  2. Colt M4A1 Carbine; developed as a smaller, more reliable and modular variant of the M16.
  3. 5.56x45mm NATO, 100 Round Beta-C Dual Drum Magazine or standard STANAG 30 round magazine.
  4. Popular weapon for urban warfare, and the standard weapon of the United States Marine Corps.
  5. Sight0 = Flip-up Iron Sight
  6. Sight1 = Red Dot
  7. Sight2 = EOTech Holographic
  8. Sight3 = AimPoint M4 Red Dot Scope
  9. Magazines: "STANAG" = 30 Round STANAG, "Beta-C" = 100 Round Beta-C.
  10. Stocks: 0 = None, 1 = Folding, 2 = Standard Telescoping.
  11. Recievers: 0 = Standard 1 = CQB.
  12. --]]
  13.  
  14.  
  15. if script == nil then return end
  16.  
  17.  
  18. Player = game:GetService("Players").LocalPlayer
  19. Char = Player.Character
  20. animate = Char:findFirstChild("Animate")
  21. if animate then
  22. animate:Destroy()
  23. end
  24. Name = "M4A1 Carbine"
  25. -- Mechanics
  26. WSPenalty = 15
  27. Reliability = 75
  28. Jammed = false
  29. Mode = 0
  30. Spread = 900000
  31. -- Appearance
  32. Reciever = 1
  33. MC = BrickColor.new("Grime")
  34. DC = BrickColor.new("Really black")
  35. GC = BrickColor.new("Grime")
  36. MR = 0
  37. GR = 0
  38. Magazine = "STANAG"
  39. Sight = 2
  40. Grip = true
  41. Attachment = true
  42. Stock = 1
  43. -- Stats/Abilities
  44. selected = false
  45. canDual = false
  46. dual = false
  47. Button1Down = false
  48. damage = 18
  49. canFire = true
  50. canFire2 = false
  51. readyTime = 0.11
  52. automatic = true
  53. burst = false
  54. burstCount = 0
  55. burstCountMax = 3
  56. canSilence = true
  57. silenced = false
  58. canZoom = false
  59. zoom = false
  60. switchToSingle = true
  61. switchToBurst = true
  62. switchToAutomatic = true
  63.  
  64.  
  65. ammoGui = Instance.new("ScreenGui")
  66. ammoGui.Name = Name
  67. local frame = Instance.new("Frame")
  68. frame.Name = "Frame"
  69. frame.Size = UDim2.new(0, 165, 0, 60)
  70. frame.Position = UDim2.new(0, 0, 1, -400)
  71. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  72. frame.BorderColor3 = Color3.new(0, 0, 0)
  73. frame.Parent = ammoGui
  74. local label = Instance.new("TextLabel")
  75. label.Name = "Weapon"
  76. label.Text = "Weapon: " ..Name
  77. label.Size = UDim2.new(1, 0, 0, 20)
  78. label.Position = UDim2.new(0, 0, 0, 0)
  79. label.BackgroundColor3 = Color3.new(1, 0, 0)
  80. label.BorderColor3 = Color3.new(0, 0, 0)
  81. label.Parent = frame
  82. local label = Instance.new("TextLabel")
  83. label.Name = "MagazinePrefix"
  84. label.Text = " " ..Magazine.. " Magazine:"
  85. label.TextXAlignment = "Left"
  86. label.Size = UDim2.new(1, 0, 0, 20)
  87. label.Position = UDim2.new(0, 0, 0, 20)
  88. label.BackgroundColor3 = Color3.new(1, 1, 1)
  89. label.BorderColor3 = Color3.new(0, 0, 0)
  90. label.Parent = frame
  91. local label = Instance.new("TextLabel")
  92. label.Name = "Magazine"
  93. label.Text = "0/0"
  94. label.TextXAlignment = "Right"
  95. label.Size = UDim2.new(1, 0, 0, 20)
  96. label.Position = UDim2.new(0, -10, 0, 20)
  97. label.BackgroundTransparency = 1
  98. label.BorderSizePixel = 0
  99. label.Parent = frame
  100. local label = Instance.new("TextLabel")
  101. label.Name = "AmmoPrefix"
  102. label.Text = " 5.56x45mm NATO:"
  103. label.TextXAlignment = "Left"
  104. label.Size = UDim2.new(1, 0, 0, 20)
  105. label.Position = UDim2.new(0, 0, 0, 40)
  106. label.BackgroundColor3 = Color3.new(1, 1, 1)
  107. label.BorderColor3 = Color3.new(0, 0, 0)
  108. label.Parent = frame
  109. local label = Instance.new("TextLabel")
  110. label.Name = "Ammo"
  111. label.Text = "0/0"
  112. label.TextXAlignment = "Right"
  113. label.Size = UDim2.new(1, 0, 0, 20)
  114. label.Position = UDim2.new(0, -10, 0, 40)
  115. label.BackgroundTransparency = 1
  116. label.BorderSizePixel = 0
  117. label.Parent = frame
  118.  
  119.  
  120. function updateGui()
  121. if selected == false then return end
  122. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  123. if Player.PlayerGui:FindFirstChild(Name) == nil then
  124. ammoGui:Clone().Parent = Player.PlayerGui
  125. end
  126. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  127. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  128. end
  129.  
  130.  
  131. function makeParts(format)
  132. local model = Instance.new("Model")
  133. model.Name = Name
  134. local pm = Instance.new("Part")
  135. pm.Name = "Handle"
  136. pm.formFactor = "Symmetric"
  137. pm.Size = Vector3.new(1, 1, 1)
  138. pm.BrickColor = MC
  139. pm.Reflectance = MR
  140. pm.CanCollide = false
  141. pm.Locked = true
  142. pm.TopSurface = 0
  143. pm.BottomSurface = 0
  144. pm.Parent = model
  145. local m = Instance.new("BlockMesh")
  146. m.Scale = Vector3.new(0.3, 1.1, 0.41)
  147. m.Offset = Vector3.new(0, -0.14, 0.07)
  148. m.Parent = pm
  149. if format ~= nil then
  150. local w = Instance.new("Weld")
  151. w.Part0 = pm
  152. if format == "RightHand" then
  153. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  154. w.C0 = CFrame.new(0, 1.15, 0.7)
  155. w.C1 = CFrame.new()
  156. elseif format == "RightHolster" then
  157. w.Part1 = Player.Character:FindFirstChild("Torso")
  158. w.C0 = CFrame.new(-0.65, -0.6, 0.4) * CFrame.fromEulerAnglesXYZ(math.rad(40), math.rad(90), 0)
  159. w.C1 = CFrame.new()
  160. model.Name = Name.. " (Holstered)"
  161. end
  162. w.Parent = pm
  163. model.Parent = Player.Character
  164. end
  165. --[[
  166. sniper1 http://www.roblox.com/asset/?id=1868836
  167. equip http://www.roblox.com/asset/?id=13510737
  168. fire1 http://www.roblox.com/asset/?id=2760979
  169. fire2 http://www.roblox.com/asset/?id=13510352
  170. fire3 http://www.roblox.com/asset/?id=2692806
  171. fire4 http://www.roblox.com/asset/?id=2691586
  172. fire5 http://www.roblox.com/asset/?id=2920959
  173. fire6 http://www.roblox.com/asset/?id=2697431
  174. fire7 http://www.roblox.com/asset/?id=2920959
  175. reload1 http://www.roblox.com/asset/?id=2691591
  176. reload2 http://www.roblox.com/asset/?id=2697432
  177. reload3 http://www.roblox.com/asset/?id=2920960
  178. reload4 http://www.roblox.com/asset/?id=2761842
  179. shotgun1 http://www.roblox.com/asset/?id=2697294
  180. --]]
  181. local s = Instance.new("Sound")
  182. s.Name = "Fire"
  183. s.SoundId = "http://www.roblox.com/Asset/?id=2920959" --"http://www.roblox.com/asset/?id=2920959"
  184. s.Volume = 1
  185. s.Pitch = 1.8
  186. s.Looped = false
  187. s.Parent = pm
  188. local s = Instance.new("Sound")
  189. s.Name = "Fire2"
  190. s.SoundId = "http://www.roblox.com/Asset/?id=10209633"
  191. s.Volume = 1
  192. s.Pitch = 3
  193. s.Looped = false
  194. s.Parent = pm
  195. local s = Instance.new("Sound")
  196. s.Name = "Jam"
  197. s.SoundId = "http://www.roblox.com/Asset/?id=10209636"
  198. s.Volume = 1
  199. s.Pitch = 2
  200. s.Looped = false
  201. s.Parent = pm
  202. local s = Instance.new("Sound")
  203. s.Name = "Lock"
  204. s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
  205. s.Volume = 1
  206. s.Pitch = 3
  207. s.Looped = false
  208. s.Parent = pm
  209. local s = Instance.new("Sound")
  210. s.Name = "Release"
  211. s.SoundId = "http://www.roblox.com/Asset/?id=10209813"
  212. s.Volume = 1
  213. s.Pitch = 2
  214. s.Looped = false
  215. s.Parent = pm
  216. local s = Instance.new("Sound")
  217. s.Name = "Reload"
  218. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  219. s.Volume = 1
  220. s.Pitch = 7.5
  221. s.Looped = false
  222. s.Parent = pm
  223. local s = Instance.new("Sound")
  224. s.Name = "Empty"
  225. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  226. s.Volume = 1
  227. s.Pitch = 5
  228. s.Looped = false
  229. s.Parent = pm
  230. local s = Instance.new("Sound")
  231. s.Name = "Switch"
  232. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  233. s.Volume = 1
  234. s.Pitch = 10
  235. s.Looped = false
  236. s.Parent = pm
  237. local s = Instance.new("Sound")
  238. s.Name = "Equip"
  239. s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
  240. s.Volume = 1
  241. s.Pitch = 1.2
  242. s.Looped = false
  243. s.Parent = pm
  244. local p = Instance.new("Part")
  245. p.Name = "ShellOut"
  246. p.formFactor = "Symmetric"
  247. p.Size = Vector3.new(1, 1, 1)
  248. p.Transparency = 1
  249. p.Locked = true
  250. p.CanCollide = false
  251. p.TopSurface = 0
  252. p.BottomSurface = 0
  253. p.Parent = model
  254. local w = Instance.new("Weld")
  255. w.Part0 = p
  256. w.Part1 = pm
  257. w.C0 = CFrame.new(0, 0.4, 0.1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  258. w.C1 = CFrame.new()
  259. w.Parent = p
  260. local p = Instance.new("Part")
  261. p.Name = "Grip"
  262. p.formFactor = "Symmetric"
  263. p.Size = Vector3.new(1, 1, 1)
  264. p.BrickColor = GC
  265. p.Reflectance = GR
  266. p.CanCollide = false
  267. p.Locked = true
  268. p.TopSurface = 0
  269. p.BottomSurface = 0
  270. p.Parent = model
  271. local m = Instance.new("BlockMesh")
  272. m.Scale = Vector3.new(0.29, 0.38, 0.8)
  273. m.Parent = p
  274. local w = Instance.new("Weld")
  275. w.Part0 = p
  276. w.Part1 = pm
  277. w.C0 = CFrame.new(0, -0.15, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  278. w.C1 = CFrame.new()
  279. w.Parent = p
  280. local p = Instance.new("Part")
  281. p.Name = "Magazine Housing"
  282. p.formFactor = "Symmetric"
  283. p.Size = Vector3.new(1, 1, 1)
  284. p.BrickColor = MC
  285. p.Reflectance = MR
  286. p.CanCollide = false
  287. p.Locked = true
  288. p.TopSurface = 0
  289. p.BottomSurface = 0
  290. p.Parent = model
  291. local m = Instance.new("BlockMesh")
  292. m.Scale = Vector3.new(0.3, 0.46, 0.4)
  293. m.Parent = p
  294. local w = Instance.new("Weld")
  295. w.Part0 = p
  296. w.Part1 = pm
  297. w.C0 = CFrame.new(0, 0.46, -0.21)
  298. w.C1 = CFrame.new()
  299. w.Parent = p
  300. local p = Instance.new("Part")
  301. p.Name = "BoltHole" --------------
  302. p.CanCollide = false
  303. p.formFactor = "Symmetric"
  304. p.Size = Vector3.new(1, 1, 1)
  305. p.BrickColor = BrickColor.new("Really black")
  306. p.Locked = true
  307. p.TopSurface = 0
  308. p.BottomSurface = 0
  309. p.Parent = model
  310. local m = Instance.new("CylinderMesh")
  311. m.Scale = Vector3.new(0.13, 0.29, 0.13)
  312. m.Parent = p
  313. local w = Instance.new("Weld")
  314. w.Part0 = p
  315. w.Part1 = pm
  316. w.C0 = CFrame.new(-0.1, 0.4, -0.04)
  317. w.C1 = CFrame.new()
  318. w.Parent = p
  319. local p = Instance.new("Part")
  320. p.Name = "MagazineHole"
  321. p.formFactor = "Symmetric"
  322. p.Size = Vector3.new(1, 1, 1)
  323. p.BrickColor = BrickColor.new("Really black")
  324. p.CanCollide = false
  325. p.Locked = true
  326. p.TopSurface = 0
  327. p.BottomSurface = 0
  328. p.Parent = model
  329. local m = Instance.new("BlockMesh")
  330. m.Scale = Vector3.new(0.28, 0.44, 0.406)
  331. m.Parent = p
  332. local w = Instance.new("Weld")
  333. w.Part0 = p
  334. w.Part1 = pm
  335. w.C0 = CFrame.new(0, 0.46, -0.21)
  336. w.C1 = CFrame.new()
  337. w.Parent = p
  338. if Magazine == "Beta-C" then
  339. local pm2 = Instance.new("Part")
  340. pm2.Name = "Magazine"
  341. pm2.formFactor = "Symmetric"
  342. pm2.Size = Vector3.new(1, 1, 1)
  343. pm2.BrickColor = BrickColor.new("Dark stone grey")
  344. pm2.Locked = true
  345. pm2.CanCollide = false
  346. pm2.TopSurface = 0
  347. pm2.BottomSurface = 0
  348. pm2.Parent = model
  349. local m = Instance.new("BlockMesh")
  350. m.Scale = Vector3.new(0.25, 0.43, 0.6)
  351. m.Parent = pm2
  352. local w = Instance.new("Weld")
  353. w.Part0 = pm2
  354. w.Part1 = pm
  355. w.C0 = CFrame.new(0, 0.425, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-6), 0, 0)
  356. w.C1 = CFrame.new()
  357. w.Parent = p
  358. local p = Instance.new("Part")
  359. p.Name = "MagPull1"
  360. p.formFactor = "Symmetric"
  361. p.Size = Vector3.new(1, 1, 1)
  362. p.BrickColor = BrickColor.new("Dark stone grey")
  363. p.Locked = true
  364. p.CanCollide = false
  365. p.TopSurface = 0
  366. p.BottomSurface = 0
  367. p.Parent = model
  368. local m = Instance.new("CylinderMesh")
  369. m.Scale = Vector3.new(0.5, 0.43, 0.5)
  370. m.Parent = p
  371. local w = Instance.new("Weld")
  372. w.Part0 = p
  373. w.Part1 = pm2
  374. w.C0 = CFrame.new(-0.26, 0, -0.12)
  375. w.C1 = CFrame.new()
  376. w.Parent = p
  377. local p = Instance.new("Part")
  378. p.Name = "MagPull2"
  379. p.formFactor = "Symmetric"
  380. p.Size = Vector3.new(1, 1, 1)
  381. p.BrickColor = BrickColor.new("Dark stone grey")
  382. p.Locked = true
  383. p.CanCollide = false
  384. p.TopSurface = 0
  385. p.BottomSurface = 0
  386. p.Parent = model
  387. local m = Instance.new("CylinderMesh")
  388. m.Scale = Vector3.new(0.5, 0.43, 0.5)
  389. m.Parent = p
  390. local w = Instance.new("Weld")
  391. w.Part0 = p
  392. w.Part1 = pm2
  393. w.C0 = CFrame.new(0.26, 0, -0.12)
  394. w.C1 = CFrame.new()
  395. w.Parent = p
  396. elseif Magazine == "STANAG" then
  397. local pm2 = Instance.new("Part")
  398. pm2.Name = "Magazine"
  399. pm2.formFactor = "Symmetric"
  400. pm2.Size = Vector3.new(1, 1, 1)
  401. pm2.BrickColor = BrickColor.new("Dark stone grey")
  402. pm2.Locked = true
  403. pm2.CanCollide = false
  404. pm2.TopSurface = 0
  405. pm2.BottomSurface = 0
  406. pm2.Parent = model
  407. local m = Instance.new("BlockMesh")
  408. m.Scale = Vector3.new(0.25, 0.43, 0.8)
  409. m.Parent = pm2
  410. local w = Instance.new("Weld")
  411. w.Part0 = pm2
  412. w.Part1 = pm
  413. w.C0 = CFrame.new(0, 0.425, -0.6) * CFrame.fromEulerAnglesXYZ(math.rad(-6), 0, 0)
  414. w.C1 = CFrame.new()
  415. w.Parent = p
  416. local p = Instance.new("Part")
  417. p.Name = "MagPull1"
  418. p.formFactor = "Symmetric"
  419. p.Size = Vector3.new(1, 1, 1)
  420. p.BrickColor = BrickColor.new("Sand green")
  421. p.Locked = true
  422. p.CanCollide = false
  423. p.TopSurface = 0
  424. p.BottomSurface = 0
  425. p.Parent = model
  426. local m = Instance.new("BlockMesh")
  427. m.Scale = Vector3.new(0.26, 0.44, 0.2)
  428. m.Parent = p
  429. local w = Instance.new("Weld")
  430. w.Part0 = p
  431. w.Part1 = pm2
  432. w.C0 = CFrame.new(0, 0, -0.15)
  433. w.C1 = CFrame.new()
  434. w.Parent = p
  435. local p = Instance.new("Part")
  436. p.Name = "MagPull2"
  437. p.formFactor = "Symmetric"
  438. p.Size = Vector3.new(1, 1, 1)
  439. p.BrickColor = BrickColor.new("Sand green")
  440. p.Locked = true
  441. p.CanCollide = false
  442. p.TopSurface = 0
  443. p.BottomSurface = 0
  444. p.Parent = model
  445. local m = Instance.new("BlockMesh")
  446. m.Scale = Vector3.new(0.26, 0.2, 0.3)
  447. m.Parent = p
  448. local w = Instance.new("Weld")
  449. w.Part0 = p
  450. w.Part1 = pm2
  451. w.C0 = CFrame.new(0, 0, -0.3)
  452. w.C1 = CFrame.new()
  453. w.Parent = p
  454. else end
  455. local p = Instance.new("Part")
  456. p.Name = "Trigger Housing"
  457. p.formFactor = "Symmetric"
  458. p.Size = Vector3.new(1, 1, 1)
  459. p.BrickColor = MC
  460. p.Reflectance = MR
  461. p.CanCollide = false
  462. p.Locked = true
  463. p.TopSurface = 0
  464. p.BottomSurface = 0
  465. p.Parent = model
  466. local m = Instance.new("BlockMesh")
  467. m.Scale = Vector3.new(0.1, 0.4, 0.025)
  468. m.Parent = p
  469. local w = Instance.new("Weld")
  470. w.Part0 = p
  471. w.Part1 = pm
  472. w.C0 = CFrame.new(0, 0.1, -0.38)
  473. w.C1 = CFrame.new()
  474. w.Parent = p
  475. local p = Instance.new("Part")
  476. p.Name = "Trigger"
  477. p.formFactor = "Symmetric"
  478. p.Size = Vector3.new(1, 1, 1)
  479. p.BrickColor = MC
  480. p.Reflectance = MR
  481. p.CanCollide = false
  482. p.Locked = true
  483. p.TopSurface = 0
  484. p.BottomSurface = 0
  485. p.Parent = model
  486. local m = Instance.new("BlockMesh")
  487. m.Scale = Vector3.new(0.1, 0.05, 0.15)
  488. m.Parent = p
  489. local w = Instance.new("Weld")
  490. w.Part0 = p
  491. w.Part1 = pm
  492. w.C0 = CFrame.new(0, 0.03, -0.275)
  493. w.C1 = CFrame.new()
  494. w.Parent = p
  495. local p = Instance.new("Part")
  496. p.Name = "Center" --------------
  497. p.CanCollide = false
  498. p.formFactor = "Symmetric"
  499. p.Size = Vector3.new(1, 1, 1)
  500. p.BrickColor = MC
  501. p.Reflectance = MR
  502. p.Locked = true
  503. p.TopSurface = 0
  504. p.BottomSurface = 0
  505. p.Parent = model
  506. local m = Instance.new("CylinderMesh")
  507. m.Scale = Vector3.new(0.32, 1.1, 0.32)
  508. m.Parent = p
  509. local w = Instance.new("Weld")
  510. w.Part0 = p
  511. w.Part1 = pm
  512. w.C0 = CFrame.new(0, 0.14, -0.04)
  513. w.C1 = CFrame.new()
  514. w.Parent = p
  515. local p = Instance.new("Part")
  516. p.Name = "CHandleC" --------------
  517. p.CanCollide = false
  518. p.formFactor = "Symmetric"
  519. p.Size = Vector3.new(1, 1, 1)
  520. p.BrickColor = DC
  521. p.Reflectance = MR
  522. p.Locked = true
  523. p.TopSurface = 0
  524. p.BottomSurface = 0
  525. p.Parent = model
  526. local m = Instance.new("CylinderMesh")
  527. m.Scale = Vector3.new(0.32, 0.1, 0.32)
  528. m.Parent = p
  529. local w = Instance.new("Weld")
  530. w.Part0 = p
  531. w.Part1 = pm
  532. w.C0 = CFrame.new(0, -0.08, -0.38) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  533. w.C1 = CFrame.new()
  534. w.Parent = p
  535. local p = Instance.new("Part")
  536. p.Name = "CHandleB" --------------
  537. p.CanCollide = false
  538. p.formFactor = "Symmetric"
  539. p.Size = Vector3.new(1, 1, 1)
  540. p.BrickColor = DC
  541. p.Reflectance = MR
  542. p.Transparency = 1
  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.32, 0.1, 0.32)
  549. m.Parent = p
  550. local w = Instance.new("Weld")
  551. w.Part0 = p
  552. w.Part1 = pm
  553. w.C0 = CFrame.new(0, -0.08, -0.72) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  554. w.C1 = CFrame.new()
  555. w.Parent = p
  556. local p = Instance.new("Part")
  557. p.Name = "CHandleB1" --------------
  558. p.CanCollide = false
  559. p.formFactor = "Symmetric"
  560. p.Size = Vector3.new(1, 1, 1)
  561. p.BrickColor = DC
  562. p.Reflectance = MR
  563. p.Transparency = 1
  564. p.Locked = true
  565. p.TopSurface = 0
  566. p.BottomSurface = 0
  567. p.Parent = model
  568. local m = Instance.new("BlockMesh")
  569. m.Scale = Vector3.new(0.15, 0.8, 0.1)
  570. m.Parent = p
  571. local w = Instance.new("Weld")
  572. w.Part0 = p
  573. w.Part1 = pm
  574. w.C0 = CFrame.new(0, -0.3, 0.08)
  575. w.C1 = CFrame.new()
  576. w.Parent = p
  577. local p = Instance.new("Part")
  578. p.Name = "Bolt" --------------
  579. p.CanCollide = false
  580. p.formFactor = "Symmetric"
  581. p.Size = Vector3.new(1, 1, 1)
  582. p.BrickColor = BrickColor.new("Dark stone grey")
  583. p.Locked = true
  584. p.TopSurface = 0
  585. p.BottomSurface = 0
  586. p.Parent = model
  587. local m = Instance.new("CylinderMesh")
  588. m.Name = "Mesh"
  589. m.Scale = Vector3.new(0.14, 0.3, 0.14)
  590. m.Offset = Vector3.new(0, 0, 0)
  591. m.Parent = p
  592. local w = Instance.new("Weld")
  593. w.Part0 = p
  594. w.Part1 = pm
  595. w.C0 = CFrame.new(-0.1, 0.4, -0.04)
  596. w.C1 = CFrame.new()
  597. w.Parent = p
  598. local p = Instance.new("Part")
  599. p.Name = "DustCover" --------------
  600. p.CanCollide = false
  601. p.formFactor = "Symmetric"
  602. p.Size = Vector3.new(1, 1, 1)
  603. p.BrickColor = DC
  604. p.Locked = true
  605. p.TopSurface = 0
  606. p.BottomSurface = 0
  607. p.Parent = model
  608. local m = Instance.new("BlockMesh")
  609. m.Name = "Mesh"
  610. m.Scale = Vector3.new(0.14, 0.34, 0.14)
  611. m.Offset = Vector3.new(0, 0, 0)
  612. m.Parent = p
  613. local s = Instance.new("Smoke")
  614. s.Enabled = false
  615. s.Name = "Smoke"
  616. s.RiseVelocity = 0
  617. s.Opacity = 0.1
  618. s.Color = Color3.new(90 / 225, 90 / 225, 90 / 225)
  619. s.Size = 0.2
  620. s.Parent = p
  621. local w = Instance.new("Weld")
  622. w.Part0 = p
  623. w.Part1 = pm
  624. w.C0 = CFrame.new(0, 0, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  625. w.C1 = CFrame.new()
  626. w.Parent = p
  627. local w = Instance.new("Weld")
  628. w.Part0 = p
  629. w.Part1 = pm
  630. w.C0 = CFrame.new(-0.105, 0.4, -0.06) * CFrame.fromEulerAnglesXYZ(0, math.rad(-6), 0)
  631. w.C1 = CFrame.new()
  632. w.Parent = p
  633. local p = Instance.new("Part")
  634. p.Name = "ForeBarrel"
  635. p.CanCollide = false
  636. p.formFactor = "Symmetric"
  637. p.Size = Vector3.new(1, 1, 1)
  638. p.BrickColor = GC
  639. p.Reflectance = GR
  640. p.Locked = true
  641. p.TopSurface = 0
  642. p.BottomSurface = 0
  643. p.Parent = model
  644. local m = Instance.new("CylinderMesh")
  645. m.Scale = Vector3.new(0.36, 0.8, 0.36)
  646. m.Parent = p
  647. local w = Instance.new("Weld")
  648. w.Part0 = p
  649. w.Part1 = pm
  650. w.C0 = CFrame.new(0, 1.08, -0.04)
  651. w.C1 = CFrame.new()
  652. w.Parent = p
  653. local p = Instance.new("Part")
  654. p.Name = "Rail" --------------
  655. p.CanCollide = false
  656. p.formFactor = "Symmetric"
  657. p.Size = Vector3.new(1, 1, 1)
  658. p.BrickColor = MC
  659. p.Reflectance = MR
  660. p.Locked = true
  661. p.TopSurface = 0
  662. p.BottomSurface = 0
  663. p.Parent = model
  664. local m = Instance.new("BlockMesh")
  665. m.Scale = Vector3.new(0.36, 0.7, 0.18)
  666. m.Parent = p
  667. local w = Instance.new("Weld")
  668. w.Part0 = p
  669. w.Part1 = pm
  670. w.C0 = CFrame.new(0, 1.08, -0.04)
  671. w.C1 = CFrame.new()
  672. w.Parent = p
  673. local p = Instance.new("Part")
  674. p.Name = "Rail" --------------
  675. p.CanCollide = false
  676. p.formFactor = "Symmetric"
  677. p.Size = Vector3.new(1, 1, 1)
  678. p.BrickColor = MC
  679. p.Reflectance = MR
  680. p.Locked = true
  681. p.TopSurface = 0
  682. p.BottomSurface = 0
  683. p.Parent = model
  684. local m = Instance.new("BlockMesh")
  685. m.Scale = Vector3.new(0.18, 0.7, 0.36)
  686. m.Parent = p
  687. local w = Instance.new("Weld")
  688. w.Part0 = p
  689. w.Part1 = pm
  690. w.C0 = CFrame.new(0, 1.08, -0.04)
  691. w.C1 = CFrame.new()
  692. w.Parent = p
  693. if Reciever == 0 then
  694. local p = Instance.new("Part")
  695. p.Name = "Barrel 1"
  696. p.formFactor = "Symmetric"
  697. p.Size = Vector3.new(1, 1, 1)
  698. p.BrickColor = DC
  699. p.Reflectance = MR
  700. p.CanCollide = false
  701. p.Locked = true
  702. p.TopSurface = 0
  703. p.BottomSurface = 0
  704. p.Parent = model
  705. local m = Instance.new("CylinderMesh")
  706. m.Scale = Vector3.new(0.15, 0.8, 0.15)
  707. m.Parent = p
  708. local w = Instance.new("Weld")
  709. w.Part0 = p
  710. w.Part1 = pm
  711. w.C0 = CFrame.new(0, 1.6, -0.04)
  712. w.C1 = CFrame.new()
  713. w.Parent = p
  714. local p = Instance.new("Part")
  715. p.Name = "Hole"
  716. p.formFactor = "Symmetric"
  717. p.Size = Vector3.new(1, 1, 1)
  718. p.BrickColor = BrickColor.new("Really black")
  719. p.CanCollide = false
  720. p.Locked = true
  721. p.TopSurface = 0
  722. p.BottomSurface = 0
  723. p.Parent = model
  724. local m = Instance.new("CylinderMesh")
  725. m.Scale = Vector3.new(0.1, 0.4, 0.1)
  726. m.Offset = Vector3.new(0, 0.2, 0)
  727. m.Parent = p
  728. local w = Instance.new("Weld")
  729. w.Part0 = p
  730. w.Part1 = pm
  731. w.C0 = CFrame.new(0, 2.403, -0.04)
  732. w.C1 = CFrame.new()
  733. w.Parent = p
  734. local p = Instance.new("Part")
  735. if silenced == false then
  736. p.Name = "Muzzle"
  737. else
  738. p.Name = "Muzzle 2"
  739. end
  740. p.formFactor = "Symmetric"
  741. p.Size = Vector3.new(1, 1, 1)
  742. p.BrickColor = DC
  743. p.Reflectance = MR
  744. p.CanCollide = false
  745. p.Locked = true
  746. p.TopSurface = 0
  747. p.BottomSurface = 0
  748. p.Parent = model
  749. local m = Instance.new("CylinderMesh")
  750. m.Scale = Vector3.new(0.18, 0.4, 0.18)
  751. m.Offset = Vector3.new(0, 0.2, 0)
  752. m.Parent = p
  753. local w = Instance.new("Weld")
  754. w.Part0 = p
  755. w.Part1 = pm
  756. w.C0 = CFrame.new(0, 2.4, -0.04)
  757. w.C1 = CFrame.new()
  758. w.Parent = p
  759. local s = Instance.new("Smoke")
  760. s.Enabled = false
  761. s.Name = "Smoke"
  762. s.RiseVelocity = -5
  763. s.Opacity = 0.3
  764. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  765. s.Size = 1
  766. s.Parent = p
  767. local f = Instance.new("Fire")
  768. f.Enabled = false
  769. f.Name = "Fire"
  770. f.Heat = -35
  771. f.Size = 1
  772. f.Parent = p
  773. local p = Instance.new("Part")
  774. p.formFactor = "Symmetric"
  775. p.Size = Vector3.new(1, 1, 1)
  776. p.BrickColor = MC
  777. p.CanCollide = false
  778. if silenced == false then
  779. p.Name = "Silencer"
  780. p.Transparency = 1
  781. else
  782. p.Name = "Muzzle"
  783. p.Transparency = 0
  784. end
  785. p.Locked = true
  786. p.TopSurface = 0
  787. p.BottomSurface = 0
  788. p.Parent = model
  789. local m = Instance.new("CylinderMesh")
  790. m.Scale = Vector3.new(0.25, 0.8, 0.25)
  791. m.Parent = p
  792. local w = Instance.new("Weld")
  793. w.Part0 = p
  794. w.Part1 = pm
  795. w.C0 = CFrame.new(0, 2.5, -0.04)
  796. w.C1 = CFrame.new()
  797. w.Parent = p
  798. local p = Instance.new("Part")
  799. p.Name = "Silencer1"
  800. p.formFactor = "Symmetric"
  801. p.Size = Vector3.new(1, 1, 1)
  802. p.BrickColor = BrickColor.new("Dark stone grey")
  803. p.CanCollide = false
  804. if silenced == false then
  805. p.Transparency = 1
  806. else
  807. p.Transparency = 0
  808. end
  809. p.Locked = true
  810. p.TopSurface = 0
  811. p.BottomSurface = 0
  812. p.Parent = model
  813. local m = Instance.new("CylinderMesh")
  814. m.Scale = Vector3.new(0.255, 0.6, 0.255)
  815. m.Parent = p
  816. local w = Instance.new("Weld")
  817. w.Part0 = p
  818. w.Part1 = pm
  819. w.C0 = CFrame.new(0, 2.5, -0.04)
  820. w.C1 = CFrame.new()
  821. w.Parent = p
  822. local p = Instance.new("Part")
  823. p.Name = "Silencer2"
  824. p.formFactor = "Symmetric"
  825. p.Size = Vector3.new(1, 1, 1)
  826. p.BrickColor = BrickColor.new("Really black")
  827. p.CanCollide = false
  828. if silenced == false then
  829. p.Transparency = 1
  830. else
  831. p.Transparency = 0
  832. end
  833. p.Locked = true
  834. p.TopSurface = 0
  835. p.BottomSurface = 0
  836. p.Parent = model
  837. local m = Instance.new("CylinderMesh")
  838. m.Scale = Vector3.new(0.1, 0.803, 0.1)
  839. m.Parent = p
  840. local w = Instance.new("Weld")
  841. w.Part0 = p
  842. w.Part1 = pm
  843. w.C0 = CFrame.new(0, 2.5, -0.04)
  844. w.C1 = CFrame.new()
  845. w.Parent = p
  846. local p = Instance.new("Part") -- Gas Block
  847. p.Name = "Frontsight"
  848. p.formFactor = "Symmetric"
  849. p.Size = Vector3.new(1, 1, 1)
  850. p.BrickColor = DC
  851. p.Reflectance = MR
  852. p.CanCollide = false
  853. p.Locked = true
  854. p.TopSurface = 0
  855. p.BottomSurface = 0
  856. p.Parent = model
  857. local m = Instance.new("BlockMesh")
  858. m.Scale = Vector3.new(0.08, 0.1, 0.3)
  859. m.Parent = p
  860. local w = Instance.new("Weld")
  861. w.Part0 = p
  862. w.Part1 = pm
  863. w.C0 = CFrame.new(0, 1.7, 0.1)
  864. w.C1 = CFrame.new()
  865. w.Parent = p
  866. local p = Instance.new("Part")
  867. p.Name = "Frontsight"
  868. p.formFactor = "Symmetric"
  869. p.Size = Vector3.new(1, 1, 1)
  870. p.BrickColor = DC
  871. p.Reflectance = MR
  872. p.CanCollide = false
  873. p.Locked = true
  874. p.TopSurface = 0
  875. p.BottomSurface = 0
  876. p.Parent = model
  877. local m = Instance.new("CylinderMesh")
  878. m.Scale = Vector3.new(0.1, 0.1, 0.1)
  879. m.Parent = p
  880. local w = Instance.new("Weld")
  881. w.Part0 = p
  882. w.Part1 = pm
  883. w.C0 = CFrame.new(0, 1.7, 0.28)
  884. w.C1 = CFrame.new()
  885. w.Parent = p
  886. local p = Instance.new("Part")
  887. p.Name = "FrontSight"
  888. p.CanCollide = false
  889. p.formFactor = "Symmetric"
  890. p.Size = Vector3.new(1, 1, 1)
  891. p.BrickColor = MC
  892. p.Reflectance = MR
  893. p.Locked = true
  894. p.TopSurface = 0
  895. p.BottomSurface = 0
  896. p.Parent = model
  897. local m = Instance.new("SpecialMesh")
  898. m.MeshType = "Wedge"
  899. m.Scale = Vector3.new(0.08, 0.45, 0.3)
  900. m.Parent = p
  901. local w = Instance.new("Weld")
  902. w.Part0 = p
  903. w.Part1 = pm
  904. w.C0 = CFrame.new(0, 1.45, 0.14)
  905. w.C1 = CFrame.new()
  906. w.Parent = p
  907. elseif Reciever == 1 then
  908. local p = Instance.new("Part")
  909. p.Name = "Barrel 1"
  910. p.formFactor = "Symmetric"
  911. p.Size = Vector3.new(1, 1, 1)
  912. p.BrickColor = DC
  913. p.Reflectance = MR
  914. p.CanCollide = false
  915. p.Locked = true
  916. p.TopSurface = 0
  917. p.BottomSurface = 0
  918. p.Parent = model
  919. local m = Instance.new("CylinderMesh")
  920. m.Scale = Vector3.new(0.15, 0.8, 0.15)
  921. m.Parent = p
  922. local w = Instance.new("Weld")
  923. w.Part0 = p
  924. w.Part1 = pm
  925. w.C0 = CFrame.new(0, 1.4, -0.04)
  926. w.C1 = CFrame.new()
  927. w.Parent = p
  928. local p = Instance.new("Part")
  929. p.Name = "Hole"
  930. p.formFactor = "Symmetric"
  931. p.Size = Vector3.new(1, 1, 1)
  932. p.BrickColor = BrickColor.new("Really black")
  933. p.CanCollide = false
  934. p.Locked = true
  935. p.TopSurface = 0
  936. p.BottomSurface = 0
  937. p.Parent = model
  938. local m = Instance.new("CylinderMesh")
  939. m.Scale = Vector3.new(0.1, 0.4, 0.1)
  940. m.Offset = Vector3.new(0, 0.2, 0)
  941. m.Parent = p
  942. local w = Instance.new("Weld")
  943. w.Part0 = p
  944. w.Part1 = pm
  945. w.C0 = CFrame.new(0, 2.203, -0.04)
  946. w.C1 = CFrame.new()
  947. w.Parent = p
  948. local p = Instance.new("Part")
  949. if silenced == false then
  950. p.Name = "Muzzle"
  951. else
  952. p.Name = "Muzzle 2"
  953. end
  954. p.formFactor = "Symmetric"
  955. p.Size = Vector3.new(1, 1, 1)
  956. p.BrickColor = DC
  957. p.Reflectance = MR
  958. p.CanCollide = false
  959. p.Locked = true
  960. p.TopSurface = 0
  961. p.BottomSurface = 0
  962. p.Parent = model
  963. local m = Instance.new("CylinderMesh")
  964. m.Scale = Vector3.new(0.18, 0.4, 0.18)
  965. m.Offset = Vector3.new(0, 0.2, 0)
  966. m.Parent = p
  967. local w = Instance.new("Weld")
  968. w.Part0 = p
  969. w.Part1 = pm
  970. w.C0 = CFrame.new(0, 2.2, -0.04)
  971. w.C1 = CFrame.new()
  972. w.Parent = p
  973. local s = Instance.new("Smoke")
  974. s.Enabled = false
  975. s.Name = "Smoke"
  976. s.RiseVelocity = -5
  977. s.Opacity = 0.3
  978. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  979. s.Size = 1
  980. s.Parent = p
  981. local f = Instance.new("Fire")
  982. f.Enabled = false
  983. f.Name = "Fire"
  984. f.Heat = -35
  985. f.Size = 1
  986. f.Parent = p
  987. local p = Instance.new("Part")
  988. p.formFactor = "Symmetric"
  989. p.Size = Vector3.new(1, 1, 1)
  990. p.BrickColor = MC
  991. p.CanCollide = false
  992. if silenced == false then
  993. p.Name = "Silencer"
  994. p.Transparency = 1
  995. else
  996. p.Name = "Muzzle"
  997. p.Transparency = 0
  998. end
  999. p.Locked = true
  1000. p.TopSurface = 0
  1001. p.BottomSurface = 0
  1002. p.Parent = model
  1003. local m = Instance.new("CylinderMesh")
  1004. m.Scale = Vector3.new(0.25, 0.8, 0.25)
  1005. m.Parent = p
  1006. local w = Instance.new("Weld")
  1007. w.Part0 = p
  1008. w.Part1 = pm
  1009. w.C0 = CFrame.new(0, 2.3, -0.04)
  1010. w.C1 = CFrame.new()
  1011. w.Parent = p
  1012. local p = Instance.new("Part")
  1013. p.Name = "Silencer1"
  1014. p.formFactor = "Symmetric"
  1015. p.Size = Vector3.new(1, 1, 1)
  1016. p.BrickColor = BrickColor.new("Dark stone grey")
  1017. p.CanCollide = false
  1018. if silenced == false then
  1019. p.Transparency = 1
  1020. else
  1021. p.Transparency = 0
  1022. end
  1023. p.Locked = true
  1024. p.TopSurface = 0
  1025. p.BottomSurface = 0
  1026. p.Parent = model
  1027. local m = Instance.new("CylinderMesh")
  1028. m.Scale = Vector3.new(0.255, 0.6, 0.255)
  1029. m.Parent = p
  1030. local w = Instance.new("Weld")
  1031. w.Part0 = p
  1032. w.Part1 = pm
  1033. w.C0 = CFrame.new(0, 2.3, -0.04)
  1034. w.C1 = CFrame.new()
  1035. w.Parent = p
  1036. local p = Instance.new("Part")
  1037. p.Name = "Silencer2"
  1038. p.formFactor = "Symmetric"
  1039. p.Size = Vector3.new(1, 1, 1)
  1040. p.BrickColor = BrickColor.new("Really black")
  1041. p.CanCollide = false
  1042. if silenced == false then
  1043. p.Transparency = 1
  1044. else
  1045. p.Transparency = 0
  1046. end
  1047. p.Locked = true
  1048. p.TopSurface = 0
  1049. p.BottomSurface = 0
  1050. p.Parent = model
  1051. local m = Instance.new("CylinderMesh")
  1052. m.Scale = Vector3.new(0.1, 0.803, 0.1)
  1053. m.Parent = p
  1054. local w = Instance.new("Weld")
  1055. w.Part0 = p
  1056. w.Part1 = pm
  1057. w.C0 = CFrame.new(0, 2.3, -0.04)
  1058. w.C1 = CFrame.new()
  1059. w.Parent = p
  1060. local p = Instance.new("Part") -- Gas Block
  1061. p.Name = "GasBlock"
  1062. p.formFactor = "Symmetric"
  1063. p.Size = Vector3.new(1, 1, 1)
  1064. p.BrickColor = DC
  1065. p.Reflectance = MR
  1066. p.CanCollide = false
  1067. p.Locked = true
  1068. p.TopSurface = 0
  1069. p.BottomSurface = 0
  1070. p.Parent = model
  1071. local m = Instance.new("BlockMesh")
  1072. m.Scale = Vector3.new(0.14, 0.18, 0.15)
  1073. m.Parent = p
  1074. local w = Instance.new("Weld")
  1075. w.Part0 = p
  1076. w.Part1 = pm
  1077. w.C0 = CFrame.new(0, 1.55, 0.02)
  1078. w.C1 = CFrame.new()
  1079. w.Parent = p
  1080. else end
  1081. if Stock == 1 then
  1082. local p = Instance.new("Part")
  1083. p.Name = "StockHinge"
  1084. p.CanCollide = false
  1085. p.formFactor = "Symmetric"
  1086. p.Size = Vector3.new(1, 1, 1)
  1087. p.BrickColor = DC
  1088. p.Reflectance = MR
  1089. p.Locked = true
  1090. p.TopSurface = 0
  1091. p.BottomSurface = 0
  1092. p.Parent = model
  1093. local m = Instance.new("CylinderMesh")
  1094. m.Scale = Vector3.new(0.1, 0.26, 0.1)
  1095. m.Parent = p
  1096. local w = Instance.new("Weld")
  1097. w.Part0 = p
  1098. w.Part1 = pm
  1099. w.C0 = CFrame.new(-0.14, 0.15, -0.4) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  1100. w.C1 = CFrame.new()
  1101. w.Parent = p
  1102. local ps = Instance.new("Part") -- Stock
  1103. ps.Name = "StockBase"
  1104. ps.CanCollide = false
  1105. ps.formFactor = "Symmetric"
  1106. ps.Size = Vector3.new(1, 1, 1)
  1107. ps.BrickColor = GC
  1108. ps.Reflectance = GR
  1109. ps.Locked = true
  1110. ps.TopSurface = 0
  1111. ps.BottomSurface = 0
  1112. ps.Parent = model
  1113. local m = Instance.new("BlockMesh")
  1114. m.Scale = Vector3.new(0.18, 0.6, 0.28)
  1115. m.Parent = ps
  1116. local w = Instance.new("Weld")
  1117. w.Part0 = ps
  1118. w.Part1 = pm
  1119. if selected == true then
  1120. w.C0 = CFrame.new(0, -0.65, -0.15)
  1121. else
  1122. w.C0 = CFrame.new(0.25, 0.1, -0.15) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(180))
  1123. end
  1124. w.C1 = CFrame.new()
  1125. w.Parent = ps
  1126. local p = Instance.new("Part")
  1127. p.Name = "Stock 1"
  1128. p.CanCollide = false
  1129. p.formFactor = "Symmetric"
  1130. p.Size = Vector3.new(1, 1, 1)
  1131. p.BrickColor = GC
  1132. p.Reflectance = GR
  1133. p.Locked = true
  1134. p.TopSurface = 0
  1135. p.BottomSurface = 0
  1136. p.Parent = model
  1137. local m = Instance.new("BlockMesh")
  1138. m.Scale = Vector3.new(0.18, 1, 0.28)
  1139. m.Parent = p
  1140. local w = Instance.new("Weld")
  1141. w.Part0 = p
  1142. w.Part1 = ps
  1143. w.C0 = CFrame.new(0, -0.38, 0)
  1144. w.C1 = CFrame.new()
  1145. w.Parent = p
  1146. local p = Instance.new("Part")
  1147. p.Name = "Stock 2"
  1148. p.CanCollide = false
  1149. p.formFactor = "Symmetric"
  1150. p.Size = Vector3.new(1, 1, 1)
  1151. p.BrickColor = GC
  1152. p.Reflectance = GR
  1153. p.Locked = true
  1154. p.TopSurface = 0
  1155. p.BottomSurface = 0
  1156. p.Parent = model
  1157. local m = Instance.new("BlockMesh")
  1158. m.Scale = Vector3.new(0.18, 0.2, 0.58)
  1159. m.Parent = p
  1160. local w = Instance.new("Weld")
  1161. w.Part0 = p
  1162. w.Part1 = ps
  1163. w.C0 = CFrame.new(0, -0.775, -0.28)
  1164. w.C1 = CFrame.new()
  1165. w.Parent = p
  1166. local p = Instance.new("Part")
  1167. p.Name = "StockAngle1"
  1168. p.CanCollide = false
  1169. p.formFactor = "Symmetric"
  1170. p.Size = Vector3.new(1, 1, 1)
  1171. p.BrickColor = GC
  1172. p.Reflectance = GR
  1173. p.Locked = true
  1174. p.TopSurface = 0
  1175. p.BottomSurface = 0
  1176. p.Parent = model
  1177. local m = Instance.new("BlockMesh")
  1178. m.Scale = Vector3.new(0.18, 0.18, 0.65)
  1179. m.Parent = p
  1180. local w = Instance.new("Weld")
  1181. w.Part0 = p
  1182. w.Part1 = ps
  1183. w.C0 = CFrame.new(0, -0.12, -0.56) * CFrame.fromEulerAnglesXYZ(math.rad(48), 0, 0)
  1184. w.C1 = CFrame.new()
  1185. w.Parent = p
  1186. elseif Stock == 2 then
  1187. local p = Instance.new("Part") -- Standard Stock
  1188. p.Name = "StockC"
  1189. p.CanCollide = false
  1190. p.formFactor = "Symmetric"
  1191. p.Size = Vector3.new(1, 1, 1)
  1192. p.BrickColor = GC
  1193. p.Reflectance = GR
  1194. p.Locked = true
  1195. p.TopSurface = 0
  1196. p.BottomSurface = 0
  1197. p.Parent = model
  1198. local m = Instance.new("CylinderMesh")
  1199. m.Scale = Vector3.new(0.2, 1, 0.2)
  1200. m.Parent = p
  1201. local w = Instance.new("Weld")
  1202. w.Part0 = p
  1203. w.Part1 = pm
  1204. w.C0 = CFrame.new(0, -0.6, -0.1)
  1205. w.C1 = CFrame.new()
  1206. w.Parent = p
  1207. local pt = Instance.new("Part")
  1208. pt.Name = "StockT"
  1209. pt.CanCollide = false
  1210. pt.formFactor = "Symmetric"
  1211. pt.Size = Vector3.new(1, 1, 1)
  1212. pt.BrickColor = GC
  1213. pt.Reflectance = GR
  1214. pt.Locked = true
  1215. pt.TopSurface = 0
  1216. pt.BottomSurface = 0
  1217. pt.Parent = model
  1218. local m = Instance.new("CylinderMesh")
  1219. m.Scale = Vector3.new(0.25, 0.8, 0.25)
  1220. m.Offset = Vector3.new(0, 0.4, 0)
  1221. m.Parent = pt
  1222. local w = Instance.new("Weld")
  1223. w.Part0 = pt
  1224. w.Part1 = pm
  1225. if selected == true then
  1226. w.C0 = CFrame.new(0, -0.8, -0.1)
  1227. else
  1228. w.C0 = CFrame.new(0, -0.4, -0.1)
  1229. end
  1230. w.C1 = CFrame.new()
  1231. w.Parent = pt
  1232. local p = Instance.new("Part")
  1233. p.Name = "StockAngle1"
  1234. p.CanCollide = false
  1235. p.formFactor = "Symmetric"
  1236. p.Size = Vector3.new(1, 1, 1)
  1237. p.BrickColor = GC
  1238. p.Reflectance = GR
  1239. p.Locked = true
  1240. p.TopSurface = 0
  1241. p.BottomSurface = 0
  1242. p.Parent = model
  1243. local m = Instance.new("SpecialMesh")
  1244. m.MeshType = "Wedge"
  1245. m.Scale = Vector3.new(0.2, 0.5, 0.5)
  1246. m.Parent = p
  1247. local w = Instance.new("Weld")
  1248. w.Part0 = p
  1249. w.Part1 = pt
  1250. w.C0 = CFrame.new(0, -0.3, -0.55) * CFrame.fromEulerAnglesXYZ(math.rad(270), 0, math.rad(180))
  1251. w.C1 = CFrame.new()
  1252. w.Parent = p
  1253. local p = Instance.new("Part")
  1254. p.Name = "StockAngle2"
  1255. p.CanCollide = false
  1256. p.formFactor = "Symmetric"
  1257. p.Size = Vector3.new(1, 1, 1)
  1258. p.BrickColor = GC
  1259. p.Reflectance = GR
  1260. p.Locked = true
  1261. p.TopSurface = 0
  1262. p.BottomSurface = 0
  1263. p.Parent = model
  1264. local m = Instance.new("SpecialMesh")
  1265. m.MeshType = "Wedge"
  1266. m.Scale = Vector3.new(0.2, 0.4, 0.6)
  1267. m.Parent = p
  1268. local w = Instance.new("Weld")
  1269. w.Part0 = p
  1270. w.Part1 = pt
  1271. w.C0 = CFrame.new(0, -0.24, -0.3) * CFrame.fromEulerAnglesXYZ(math.rad(270), 0, math.rad(180))
  1272. w.C1 = CFrame.new()
  1273. w.Parent = p--]]
  1274. else end
  1275. if Sight == 0 then
  1276. local p = Instance.new("Part")
  1277. p.Name = "RearSight"
  1278. p.CanCollide = false
  1279. p.formFactor = "Symmetric"
  1280. p.Size = Vector3.new(1, 1, 1)
  1281. p.BrickColor = MC
  1282. p.Reflectance = MR
  1283. p.Locked = true
  1284. p.TopSurface = 0
  1285. p.BottomSurface = 0
  1286. p.Parent = model
  1287. local m = Instance.new("CylinderMesh")
  1288. m.Scale = Vector3.new(0.2, 0.46, 0.2)
  1289. m.Parent = p
  1290. local w = Instance.new("Weld")
  1291. w.Part0 = p
  1292. w.Part1 = pm
  1293. w.C0 = CFrame.new(0, -0.06, -0.26) * CFrame.fromEulerAnglesXYZ(math.rad(100), 0, 0)
  1294. w.C1 = CFrame.new()
  1295. w.Parent = p
  1296. if Reciever == 1 then
  1297. local p = Instance.new("Part")
  1298. p.Name = "Frontsight"
  1299. p.formFactor = "Symmetric"
  1300. p.Size = Vector3.new(1, 1, 1)
  1301. p.BrickColor = DC
  1302. p.Reflectance = MR
  1303. p.CanCollide = false
  1304. p.Locked = true
  1305. p.TopSurface = 0
  1306. p.BottomSurface = 0
  1307. p.Parent = model
  1308. local m = Instance.new("BlockMesh")
  1309. m.Scale = Vector3.new(0.08, 0.1, 0.3)
  1310. m.Parent = p
  1311. local w = Instance.new("Weld")
  1312. w.Part0 = p
  1313. w.Part1 = pm
  1314. w.C0 = CFrame.new(0, 1.3, 0.1)
  1315. w.C1 = CFrame.new()
  1316. w.Parent = p
  1317. local p = Instance.new("Part")
  1318. p.Name = "Frontsight"
  1319. p.formFactor = "Symmetric"
  1320. p.Size = Vector3.new(1, 1, 1)
  1321. p.BrickColor = DC
  1322. p.Reflectance = MR
  1323. p.CanCollide = false
  1324. p.Locked = true
  1325. p.TopSurface = 0
  1326. p.BottomSurface = 0
  1327. p.Parent = model
  1328. local m = Instance.new("CylinderMesh")
  1329. m.Scale = Vector3.new(0.1, 0.1, 0.1)
  1330. m.Parent = p
  1331. local w = Instance.new("Weld")
  1332. w.Part0 = p
  1333. w.Part1 = pm
  1334. w.C0 = CFrame.new(0, 1.3, 0.28)
  1335. w.C1 = CFrame.new()
  1336. w.Parent = p
  1337. else end
  1338. elseif Sight == 1 then
  1339. local p = Instance.new("Part") -------- RDS Attachment
  1340. p.Name = "Ring"
  1341. p.formFactor = "Symmetric"
  1342. p.Size = Vector3.new(1, 1, 1)
  1343. p.BrickColor = MC
  1344. p.Reflectance = MR
  1345. p.CanCollide = false
  1346. p.Locked = true
  1347. p.TopSurface = 0
  1348. p.BottomSurface = 0
  1349. p.Parent = model
  1350. local m = Instance.new("SpecialMesh")
  1351. m.MeshType = "FileMesh"
  1352. m.MeshId = "http://www.roblox.com/asset/?id=3270017"
  1353. m.Scale = Vector3.new(0.25, 0.25, 0.8)
  1354. m.Parent = p
  1355. local w = Instance.new("Weld")
  1356. w.Part0 = p
  1357. w.Part1 = pm
  1358. w.C0 = CFrame.new(0, -0.25, 0.34) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  1359. w.C1 = CFrame.new()
  1360. w.Parent = p
  1361. local p = Instance.new("Part")
  1362. p.Name = "SightBottom"
  1363. p.CanCollide = false
  1364. p.formFactor = "Symmetric"
  1365. p.Size = Vector3.new(1, 1, 1)
  1366. p.BrickColor = MC
  1367. p.Reflectance = MR
  1368. p.Locked = true
  1369. p.TopSurface = 0
  1370. p.BottomSurface = 0
  1371. p.Parent = model
  1372. local m = Instance.new("BlockMesh")
  1373. m.Scale = Vector3.new(0.25, 0.4, 0.18)
  1374. m.Parent = p
  1375. local w = Instance.new("Weld")
  1376. w.Part0 = p
  1377. w.Part1 = pm
  1378. w.C0 = CFrame.new(0, 0.2, 0.1)
  1379. w.C1 = CFrame.new()
  1380. w.Parent = p
  1381. local p = Instance.new("Part")
  1382. p.Name = "Image"
  1383. p.CanCollide = false
  1384. p.formFactor = "Symmetric"
  1385. p.Size = Vector3.new(1, 1, 1)
  1386. p.BrickColor = MC
  1387. p.Transparency = 1
  1388. p.Locked = true
  1389. p.TopSurface = 0
  1390. p.BottomSurface = 0
  1391. p.Parent = model
  1392. local d = Instance.new("Decal")
  1393. d.Face = "Top"
  1394. d.Texture = "http://www.roblox.com/asset/?id=29712167"
  1395. d.Parent = p
  1396. local m = Instance.new("BlockMesh")
  1397. m.Scale = Vector3.new(0.1, 0.001, 0.1)
  1398. m.Parent = p
  1399. local w = Instance.new("Weld")
  1400. w.Part0 = p
  1401. w.Part1 = pm
  1402. w.C0 = CFrame.new(0, 0.34, 0.25)
  1403. w.C1 = CFrame.new()
  1404. w.Parent = p
  1405. elseif Sight == 2 then
  1406. local c = Instance.new("Part")
  1407. c.Name = "SightCube"
  1408. c.CanCollide = false
  1409. c.formFactor = "Symmetric"
  1410. c.Size = Vector3.new(1, 1, 1)
  1411. c.BrickColor = DC
  1412. c.Reflectance = MR
  1413. c.Transparency = 0.8
  1414. c.Locked = true
  1415. c.TopSurface = 0
  1416. c.BottomSurface = 0
  1417. c.Parent = model
  1418. local m = Instance.new("BlockMesh")
  1419. m.Scale = Vector3.new(0.25, 0.25, 0.25)
  1420. m.Parent = c
  1421. local w = Instance.new("Weld")
  1422. w.Part0 = c
  1423. w.Part1 = pm
  1424. w.C0 = CFrame.new(0, 0.1, 0.25)
  1425. w.C1 = CFrame.new()
  1426. w.Parent = c
  1427. local p = Instance.new("Part")
  1428. p.Name = "SightBottom"
  1429. p.CanCollide = false
  1430. p.formFactor = "Symmetric"
  1431. p.Size = Vector3.new(1, 1, 1)
  1432. p.BrickColor = DC
  1433. p.Reflectance = MR
  1434. p.Locked = true
  1435. p.TopSurface = 0
  1436. p.BottomSurface = 0
  1437. p.Parent = model
  1438. local m = Instance.new("BlockMesh")
  1439. m.Scale = Vector3.new(0.2, 0.5, 0.18)
  1440. m.Parent = p
  1441. local w = Instance.new("Weld")
  1442. w.Part0 = p
  1443. w.Part1 = c
  1444. w.C0 = CFrame.new(0, 0.125, -0.12)
  1445. w.C1 = CFrame.new()
  1446. w.Parent = p
  1447. local p = Instance.new("Part")
  1448. p.Name = "Image"
  1449. p.CanCollide = false
  1450. p.formFactor = "Symmetric"
  1451. p.Size = Vector3.new(1, 1, 1)
  1452. p.BrickColor = MC
  1453. p.Transparency = 1
  1454. p.Locked = true
  1455. p.TopSurface = 0
  1456. p.BottomSurface = 0
  1457. p.Parent = model
  1458. local d = Instance.new("Decal")
  1459. d.Face = "Top"
  1460. d.Texture = "http://www.roblox.com/asset/?id=29712167"
  1461. d.Parent = p
  1462. local m = Instance.new("BlockMesh")
  1463. m.Scale = Vector3.new(0.1, 0.001, 0.1)
  1464. m.Parent = p
  1465. local w = Instance.new("Weld")
  1466. w.Part0 = p
  1467. w.Part1 = c
  1468. w.C0 = CFrame.new(0, 0, 0)
  1469. w.C1 = CFrame.new()
  1470. w.Parent = p
  1471. local p = Instance.new("Part")
  1472. p.Name = "SightBox"
  1473. p.CanCollide = false
  1474. p.formFactor = "Symmetric"
  1475. p.Size = Vector3.new(1, 1, 1)
  1476. p.BrickColor = DC
  1477. p.Reflectance = MR
  1478. p.Locked = true
  1479. p.TopSurface = 0
  1480. p.BottomSurface = 0
  1481. p.Parent = model
  1482. local m = Instance.new("BlockMesh")
  1483. m.Scale = Vector3.new(0.05, 0.25, 0.25)
  1484. m.Offset = Vector3.new(0.1, 0, 0)
  1485. m.Parent = p
  1486. local w = Instance.new("Weld")
  1487. w.Part0 = p
  1488. w.Part1 = c
  1489. w.C0 = CFrame.new(0, 0, 0)
  1490. w.C1 = CFrame.new()
  1491. w.Parent = p
  1492. local p = Instance.new("Part")
  1493. p.Name = "SightBox"
  1494. p.CanCollide = false
  1495. p.formFactor = "Symmetric"
  1496. p.Size = Vector3.new(1, 1, 1)
  1497. p.BrickColor = DC
  1498. p.Reflectance = MR
  1499. p.Locked = true
  1500. p.TopSurface = 0
  1501. p.BottomSurface = 0
  1502. p.Parent = model
  1503. local m = Instance.new("BlockMesh")
  1504. m.Scale = Vector3.new(0.05, 0.25, 0.25)
  1505. m.Offset = Vector3.new(-0.1, 0, 0)
  1506. m.Parent = p
  1507. local w = Instance.new("Weld")
  1508. w.Part0 = p
  1509. w.Part1 = c
  1510. w.C0 = CFrame.new(0, 0, 0)
  1511. w.C1 = CFrame.new()
  1512. w.Parent = p
  1513. local p = Instance.new("Part")
  1514. p.Name = "SightBox"
  1515. p.CanCollide = false
  1516. p.formFactor = "Symmetric"
  1517. p.Size = Vector3.new(1, 1, 1)
  1518. p.BrickColor = DC
  1519. p.Reflectance = MR
  1520. p.Locked = true
  1521. p.TopSurface = 0
  1522. p.BottomSurface = 0
  1523. p.Parent = model
  1524. local m = Instance.new("BlockMesh")
  1525. m.Scale = Vector3.new(0.25, 0.25, 0.05)
  1526. m.Offset = Vector3.new(0, 0, -0.1)
  1527. m.Parent = p
  1528. local w = Instance.new("Weld")
  1529. w.Part0 = p
  1530. w.Part1 = c
  1531. w.C0 = CFrame.new(0, 0, 0)
  1532. w.C1 = CFrame.new()
  1533. w.Parent = p
  1534. local p = Instance.new("Part")
  1535. p.Name = "SightBox"
  1536. p.CanCollide = false
  1537. p.formFactor = "Symmetric"
  1538. p.Size = Vector3.new(1, 1, 1)
  1539. p.BrickColor = DC
  1540. p.Reflectance = MR
  1541. p.Locked = true
  1542. p.TopSurface = 0
  1543. p.BottomSurface = 0
  1544. p.Parent = model
  1545. local m = Instance.new("BlockMesh")
  1546. m.Scale = Vector3.new(0.25, 0.25, 0.05)
  1547. m.Offset = Vector3.new(0, 0, 0.1)
  1548. m.Parent = p
  1549. local w = Instance.new("Weld")
  1550. w.Part0 = p
  1551. w.Part1 = c
  1552. w.C0 = CFrame.new(0, 0, 0)
  1553. w.C1 = CFrame.new()
  1554. w.Parent = p
  1555. elseif Sight == 3 then
  1556. local l = Instance.new("Part") -- Aimpoint Scope
  1557. l.Name = "SightBottom"
  1558. l.CanCollide = false
  1559. l.formFactor = "Symmetric"
  1560. l.Size = Vector3.new(1, 1, 1)
  1561. l.BrickColor = DC
  1562. l.Reflectance = MR
  1563. l.Locked = true
  1564. l.TopSurface = 0
  1565. l.BottomSurface = 0
  1566. l.Parent = model
  1567. local m = Instance.new("BlockMesh")
  1568. m.Scale = Vector3.new(0.2, 0.4, 0.18)
  1569. m.Parent = l
  1570. local w = Instance.new("Weld")
  1571. w.Part0 = l
  1572. w.Part1 = pm
  1573. w.C0 = CFrame.new(0, 0.26, 0.13)
  1574. w.C1 = CFrame.new()
  1575. w.Parent = l
  1576. canZoom = true
  1577. local p = Instance.new("Part")
  1578. p.Name = "Scope"
  1579. p.formFactor = "Symmetric"
  1580. p.Size = Vector3.new(1, 1, 1)
  1581. p.BrickColor = MC
  1582. p.Reflectance = MR
  1583. p.CanCollide = false
  1584. p.Locked = true
  1585. p.TopSurface = 0
  1586. p.BottomSurface = 0
  1587. p.Parent = model
  1588. local m = Instance.new("CylinderMesh")
  1589. m.Scale = Vector3.new(0.28, 0.5, 0.28)
  1590. m.Parent = p
  1591. local w = Instance.new("Weld")
  1592. w.Part0 = p
  1593. w.Part1 = l
  1594. w.C0 = CFrame.new(0, 0, 0.16)
  1595. w.C1 = CFrame.new()
  1596. w.Parent = p
  1597. local p = Instance.new("Part")
  1598. p.Name = "ScopeInt"
  1599. p.formFactor = "Symmetric"
  1600. p.Size = Vector3.new(1, 1, 1)
  1601. p.BrickColor = BrickColor.new("White")
  1602. p.Reflectance = 0.3
  1603. p.CanCollide = false
  1604. p.Locked = true
  1605. p.TopSurface = 0
  1606. p.BottomSurface = 0
  1607. p.Parent = model
  1608. local m = Instance.new("CylinderMesh")
  1609. m.Scale = Vector3.new(0.26, 0.604, 0.26)
  1610. m.Parent = p
  1611. local w = Instance.new("Weld")
  1612. w.Part0 = p
  1613. w.Part1 = l
  1614. w.C0 = CFrame.new(0, 0, 0.16)
  1615. w.C1 = CFrame.new()
  1616. w.Parent = p
  1617. local p = Instance.new("Part")
  1618. p.Name = "Scope"
  1619. p.formFactor = "Symmetric"
  1620. p.Size = Vector3.new(1, 1, 1)
  1621. p.BrickColor = MC
  1622. p.Reflectance = MR
  1623. p.CanCollide = false
  1624. p.Locked = true
  1625. p.TopSurface = 0
  1626. p.BottomSurface = 0
  1627. p.Parent = model
  1628. local m = Instance.new("CylinderMesh")
  1629. m.Scale = Vector3.new(0.3, 0.1, 0.3)
  1630. m.Parent = p
  1631. local w = Instance.new("Weld")
  1632. w.Part0 = p
  1633. w.Part1 = l
  1634. w.C0 = CFrame.new(0, -0.25, 0.16)
  1635. w.C1 = CFrame.new()
  1636. w.Parent = p
  1637. local p = Instance.new("Part")
  1638. p.Name = "Scope"
  1639. p.formFactor = "Symmetric"
  1640. p.Size = Vector3.new(1, 1, 1)
  1641. p.BrickColor = MC
  1642. p.Reflectance = MR
  1643. p.CanCollide = false
  1644. p.Locked = true
  1645. p.TopSurface = 0
  1646. p.BottomSurface = 0
  1647. p.Parent = model
  1648. local m = Instance.new("CylinderMesh")
  1649. m.Scale = Vector3.new(0.3, 0.1, 0.3)
  1650. m.Parent = p
  1651. local w = Instance.new("Weld")
  1652. w.Part0 = p
  1653. w.Part1 = l
  1654. w.C0 = CFrame.new(0, 0.25, 0.16)
  1655. w.C1 = CFrame.new()
  1656. w.Parent = p
  1657. local p = Instance.new("Part")
  1658. p.Name = "Scope"
  1659. p.formFactor = "Symmetric"
  1660. p.Size = Vector3.new(1, 1, 1)
  1661. p.BrickColor = MC
  1662. p.Reflectance = MR
  1663. p.CanCollide = false
  1664. p.Locked = true
  1665. p.TopSurface = 0
  1666. p.BottomSurface = 0
  1667. p.Parent = model
  1668. local m = Instance.new("CylinderMesh")
  1669. m.Scale = Vector3.new(0.12, 0.5, 0.12)
  1670. m.Parent = p
  1671. local w = Instance.new("Weld")
  1672. w.Part0 = p
  1673. w.Part1 = l
  1674. w.C0 = CFrame.new(-0.12, 0, 0.24)
  1675. w.C1 = CFrame.new()
  1676. w.Parent = p
  1677. local p = Instance.new("Part")
  1678. p.Name = "Scope"
  1679. p.formFactor = "Symmetric"
  1680. p.Size = Vector3.new(1, 1, 1)
  1681. p.BrickColor = MC
  1682. p.Reflectance = MR
  1683. p.CanCollide = false
  1684. p.Locked = true
  1685. p.TopSurface = 0
  1686. p.BottomSurface = 0
  1687. p.Parent = model
  1688. local m = Instance.new("CylinderMesh")
  1689. m.Scale = Vector3.new(0.13, 0.1, 0.13)
  1690. m.Parent = p
  1691. local w = Instance.new("Weld")
  1692. w.Part0 = p
  1693. w.Part1 = l
  1694. w.C0 = CFrame.new(-0.12, 0.25, 0.24)
  1695. w.C1 = CFrame.new()
  1696. w.Parent = p
  1697. local p = Instance.new("Part")
  1698. p.Name = "Scope"
  1699. p.formFactor = "Symmetric"
  1700. p.Size = Vector3.new(1, 1, 1)
  1701. p.BrickColor = MC
  1702. p.Reflectance = MR
  1703. p.CanCollide = false
  1704. p.Locked = true
  1705. p.TopSurface = 0
  1706. p.BottomSurface = 0
  1707. p.Parent = model
  1708. local m = Instance.new("CylinderMesh")
  1709. m.Scale = Vector3.new(0.13, 0.1, 0.13)
  1710. m.Parent = p
  1711. local w = Instance.new("Weld")
  1712. w.Part0 = p
  1713. w.Part1 = l
  1714. w.C0 = CFrame.new(-0.12, -0.25, 0.24)
  1715. w.C1 = CFrame.new()
  1716. w.Parent = p
  1717. else end
  1718. if Grip == true then
  1719. local p = Instance.new("Part") --------------- ForeGrip Attachment
  1720. p.Name = "ForeGrip"
  1721. p.formFactor = "Symmetric"
  1722. p.Size = Vector3.new(1, 1, 1)
  1723. p.BrickColor = BrickColor.new("Black")
  1724. p.CanCollide = false
  1725. p.Locked = true
  1726. p.TopSurface = 0
  1727. p.BottomSurface = 0
  1728. p.Parent = model
  1729. local m = Instance.new("CylinderMesh")
  1730. m.Scale = Vector3.new(0.25, 0.6, 0.25)
  1731. m.Parent = p
  1732. local w = Instance.new("Weld")
  1733. w.Part0 = p
  1734. w.Part1 = pm
  1735. w.C0 = CFrame.new(0, 0.4, 1.1) * CFrame.fromEulerAnglesXYZ(math.rad(90), 0, 0)
  1736. w.C1 = CFrame.new()
  1737. w.Parent = p
  1738. else end
  1739. if Attachment == true then
  1740. local p = Instance.new("Part")
  1741. p.Name = "LaserPod"
  1742. p.formFactor = "Symmetric"
  1743. p.Size = Vector3.new(1, 1, 1)
  1744. p.CanCollide = false
  1745. p.BrickColor = DC
  1746. p.Reflectance = MR
  1747. p.Locked = true
  1748. p.TopSurface = 0
  1749. p.BottomSurface = 0
  1750. p.Parent = model
  1751. local m = Instance.new("BlockMesh")
  1752. m.Scale = Vector3.new(0.1, 0.35, 0.25)
  1753. m.Parent = p
  1754. local w = Instance.new("Weld")
  1755. w.Part0 = p
  1756. w.Part1 = pm
  1757. w.C0 = CFrame.new(-0.22, 1.1, -0.04)
  1758. w.C1 = CFrame.new()
  1759. w.Parent = p--]]
  1760. local p = Instance.new("Part")
  1761. p.Name = "LaserPod"
  1762. p.formFactor = "Symmetric"
  1763. p.Size = Vector3.new(1, 1, 1)
  1764. p.CanCollide = false
  1765. p.BrickColor = DC
  1766. p.Reflectance = MR
  1767. p.Locked = true
  1768. p.TopSurface = 0
  1769. p.BottomSurface = 0
  1770. p.Parent = model
  1771. local m = Instance.new("CylinderMesh")
  1772. m.Scale = Vector3.new(0.12, 0.35, 0.12)
  1773. m.Parent = p
  1774. local w = Instance.new("Weld")
  1775. w.Part0 = p
  1776. w.Part1 = pm
  1777. w.C0 = CFrame.new(-0.22, 1.1, 0.1)
  1778. w.C1 = CFrame.new()
  1779. w.Parent = p
  1780. local p = Instance.new("Part")
  1781. p.Name = "Laser"
  1782. p.CanCollide = false
  1783. p.formFactor = "Symmetric"
  1784. p.Size = Vector3.new(1, 1, 1)
  1785. p.BrickColor = BrickColor.new("Bright red")
  1786. p.Locked = true
  1787. if selected == true and Mode == 1 then
  1788. p.Transparency = 0.4
  1789. else
  1790. p.Transparency = 1
  1791. end
  1792. p.TopSurface = 0
  1793. p.BottomSurface = 0
  1794. p.Parent = model
  1795. local m = Instance.new("BlockMesh")
  1796. m.Scale = Vector3.new(0.01, 500, 0.01)
  1797. m.Offset = Vector3.new(0, -250, 0)
  1798. m.Parent = p
  1799. local w = Instance.new("Weld")
  1800. w.Part0 = p
  1801. w.Part1 = pm
  1802. w.C0 = CFrame.new(-0.22, 1.1, 0.1)
  1803. w.C1 = CFrame.new()
  1804. w.Parent = p
  1805. local p = Instance.new("Part")
  1806. p.Name = "LaserPod"
  1807. p.formFactor = "Symmetric"
  1808. p.Size = Vector3.new(1, 1, 1)
  1809. p.CanCollide = false
  1810. p.BrickColor = DC
  1811. p.Reflectance = MR
  1812. p.Locked = true
  1813. p.TopSurface = 0
  1814. p.BottomSurface = 0
  1815. p.Parent = model
  1816. local m = Instance.new("CylinderMesh")
  1817. m.Scale = Vector3.new(0.12, 0.35, 0.12)
  1818. m.Parent = p
  1819. local w = Instance.new("Weld")
  1820. w.Part0 = p
  1821. w.Part1 = pm
  1822. w.C0 = CFrame.new(-0.22, 1.1, -0.14)
  1823. w.C1 = CFrame.new()
  1824. w.Parent = p
  1825. local p = Instance.new("Part")
  1826. p.Name = "LightAttach"
  1827. p.formFactor = "Symmetric"
  1828. p.Size = Vector3.new(1, 1, 1)
  1829. p.CanCollide = false
  1830. p.BrickColor = DC
  1831. p.Reflectance = MR
  1832. p.Locked = true
  1833. p.TopSurface = 0
  1834. p.BottomSurface = 0
  1835. p.Parent = model
  1836. local m = Instance.new("CylinderMesh")
  1837. m.Scale = Vector3.new(0.2, 0.35, 0.2)
  1838. m.Parent = p
  1839. local w = Instance.new("Weld")
  1840. w.Part0 = p
  1841. w.Part1 = pm
  1842. w.C0 = CFrame.new(0.25, 1.1, -0.04)
  1843. w.C1 = CFrame.new()
  1844. w.Parent = p
  1845. local p = Instance.new("Part")
  1846. p.Name = "Light"
  1847. p.CanCollide = false
  1848. p.formFactor = "Custom"
  1849. p.Size = Vector3.new(0.2, 0.2, 0.2)
  1850. p.BrickColor = BrickColor.new("Bright yellow")
  1851. p.Locked = true
  1852. if selected == true and Mode == 2 and dual == false then
  1853. p.Transparency = 0.5
  1854. else
  1855. p.Transparency = 1
  1856. end
  1857. p.TopSurface = 0
  1858. p.BottomSurface = 0
  1859. p.Parent = model
  1860. local m = Instance.new("SpecialMesh")
  1861. m.MeshType = "FileMesh"
  1862. m.Scale = Vector3.new(2, 50, 2)
  1863. m.MeshId = "http://www.roblox.com/asset/?id=1033714"
  1864. m.Parent = p
  1865. local w = Instance.new("Weld")
  1866. w.Part0 = p
  1867. w.Part1 = pm
  1868. w.C0 = CFrame.new(0.25, 20, -0.04)
  1869. w.C1 = CFrame.new()
  1870. w.Parent = p
  1871. else end
  1872. return model
  1873. end
  1874.  
  1875.  
  1876. function removeParts(format)
  1877. if format == "RightHand" then
  1878. pcall(function() Player.Character[Name]:Remove() end)
  1879. elseif format == "LeftHand" then
  1880. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  1881. elseif format == "RightHolster" then
  1882. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  1883. elseif format == "LeftHolster" then
  1884. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  1885. end
  1886. end
  1887.  
  1888.  
  1889. function SetAngle(Joint, Angle, Character)
  1890. if Character == nil then return false end
  1891. local Joints = {
  1892. Character.Torso:FindFirstChild("Right Shoulder 2"),
  1893. Character.Torso:FindFirstChild("Left Shoulder 2"),
  1894. Character.Torso:FindFirstChild("Right Hip 2"),
  1895. Character.Torso:FindFirstChild("Left Hip 2")
  1896. }
  1897. if Joints[Joint] == nil then return false end
  1898. if Joint == 1 or Joint == 3 then
  1899. Joints[Joint].DesiredAngle = Angle
  1900. end
  1901. if Joint == 2 or Joint == 4 then
  1902. Joints[Joint].DesiredAngle = -Angle
  1903. end
  1904. end
  1905.  
  1906.  
  1907. function ForceAngle(Joint, Angle, Character)
  1908. if Character == nil then return false end
  1909. local Joints = {
  1910. Character.Torso:FindFirstChild("Right Shoulder 2"),
  1911. Character.Torso:FindFirstChild("Left Shoulder 2"),
  1912. Character.Torso:FindFirstChild("Right Hip 2"),
  1913. Character.Torso:FindFirstChild("Left Hip 2")
  1914. }
  1915. if Joints[Joint] == nil then return false end
  1916. if Joint == 1 or Joint == 3 then
  1917. Joints[Joint].DesiredAngle = Angle
  1918. Joints[Joint].CurrentAngle = Angle
  1919. end
  1920. if Joint == 2 or Joint == 4 then
  1921. Joints[Joint].DesiredAngle = -Angle
  1922. Joints[Joint].CurrentAngle = -Angle
  1923. end
  1924. end
  1925.  
  1926.  
  1927. function SetSpeed(Joint, Speed, Character)
  1928. if Character == nil then return false end
  1929. local Joints = {
  1930. Character.Torso:FindFirstChild("Right Shoulder 2"),
  1931. Character.Torso:FindFirstChild("Left Shoulder 2"),
  1932. Character.Torso:FindFirstChild("Right Hip 2"),
  1933. Character.Torso:FindFirstChild("Left Hip 2")
  1934. }
  1935. if Joints[Joint] == nil then return false end
  1936. Joints[Joint].MaxVelocity = Speed
  1937. end
  1938.  
  1939.  
  1940. function DisableLimb(Limb, Character)
  1941. if Character == nil then return false end
  1942. if Character:FindFirstChild("Torso") == nil then return false end
  1943. local Joints = {
  1944. Character.Torso:FindFirstChild("Right Shoulder"),
  1945. Character.Torso:FindFirstChild("Left Shoulder"),
  1946. Character.Torso:FindFirstChild("Right Hip"),
  1947. Character.Torso:FindFirstChild("Left Hip")
  1948. }
  1949. local Limbs = {
  1950. Character:FindFirstChild("Right Arm"),
  1951. Character:FindFirstChild("Left Arm"),
  1952. Character:FindFirstChild("Right Leg"),
  1953. Character:FindFirstChild("Left Leg")
  1954. }
  1955. if Joints[Limb] == nil then return false end
  1956. if Limbs[Limb] == nil then return false end
  1957. local Joint = Instance.new("Motor")
  1958. Joint.Parent = Character.Torso
  1959. Joint.Part0 = Character.Torso
  1960. Joint.Part1 = Limbs[Limb]
  1961. if Limb == 1 then
  1962. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1963. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1964. Joint.Name = "Right Shoulder 2"
  1965. elseif Limb == 2 then
  1966. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1967. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1968. Joint.Name = "Left Shoulder 2"
  1969. elseif Limb == 3 then
  1970. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1971. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1972. Joint.Name = "Right Hip 2"
  1973. elseif Limb == 4 then
  1974. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1975. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  1976. Joint.Name = "Left Hip 2"
  1977. end
  1978. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  1979. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  1980. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  1981. Joints[Limb]:Remove()
  1982. end
  1983.  
  1984.  
  1985. function ResetLimbCFrame(Limb, Character)
  1986. if Character == nil then return false end
  1987. if Character.Parent == nil then return false end
  1988. if Character:FindFirstChild("Torso") == nil then return false end
  1989. local Joints = {
  1990. Character.Torso:FindFirstChild("Right Shoulder 2"),
  1991. Character.Torso:FindFirstChild("Left Shoulder 2"),
  1992. Character.Torso:FindFirstChild("Right Hip 2"),
  1993. Character.Torso:FindFirstChild("Left Hip 2")
  1994. }
  1995. local Limbs = {
  1996. Character:FindFirstChild("Right Arm"),
  1997. Character:FindFirstChild("Left Arm"),
  1998. Character:FindFirstChild("Right Leg"),
  1999. Character:FindFirstChild("Left Leg")
  2000. }
  2001. if Joints[Limb] == nil then return false end
  2002. if Limbs[Limb] == nil then return false end
  2003. if Limb == 1 then
  2004. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  2005. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  2006. elseif Limb == 2 then
  2007. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  2008. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  2009. elseif Limb == 3 then
  2010. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  2011. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  2012. elseif Limb == 4 then
  2013. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  2014. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  2015. end
  2016. end
  2017.  
  2018.  
  2019. function EnableLimb(Limb, Character)
  2020. if Character == nil then return false end
  2021. if Character:FindFirstChild("Torso") == nil then return false end
  2022. local Joints = {
  2023. Character.Torso:FindFirstChild("Right Shoulder 2"),
  2024. Character.Torso:FindFirstChild("Left Shoulder 2"),
  2025. Character.Torso:FindFirstChild("Right Hip 2"),
  2026. Character.Torso:FindFirstChild("Left Hip 2")
  2027. }
  2028. local Limbs = {
  2029. Character:FindFirstChild("Right Arm"),
  2030. Character:FindFirstChild("Left Arm"),
  2031. Character:FindFirstChild("Right Leg"),
  2032. Character:FindFirstChild("Left Leg")
  2033. }
  2034. if Joints[Limb] == nil then return false end
  2035. if Limbs[Limb] == nil then return false end
  2036. if Limb == 1 then
  2037. Joints[Limb].Name = "Right Shoulder"
  2038. elseif Limb == 2 then
  2039. Joints[Limb].Name = "Left Shoulder"
  2040. elseif Limb == 3 then
  2041. Joints[Limb].Name = "Right Hip"
  2042. elseif Limb == 4 then
  2043. Joints[Limb].Name = "Left Hip"
  2044. end
  2045. Animate = Character:FindFirstChild("Animate")
  2046. if Animate == nil then return false end
  2047. Animate = Animate:Clone()
  2048. Character.Animate:Remove()
  2049. Animate.Parent = Character
  2050. end
  2051.  
  2052.  
  2053. function playAnimation(format, mouse)
  2054. if format == "equip" then
  2055. Player.Character.Humanoid.WalkSpeed = WSPenalty
  2056. Player.Character[Name.. " (Holstered)"].Handle.Weld:Remove()
  2057. local w = Instance.new("Weld")
  2058. w.Part0 = Player.Character[Name.. " (Holstered)"].Handle
  2059. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  2060. w.C0 = CFrame.new(0, 1.2, 0.7)
  2061. w.C1 = CFrame.new()
  2062. w.Parent = Player.Character[Name.. " (Holstered)"].Handle
  2063. for i = 0.01, 1, 0.1 do
  2064. if Player.Character:FindFirstChild("Torso") ~= nil then
  2065. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2066. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2067. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  2068. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2069. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  2070. wait()
  2071. else return false end
  2072. else return false end
  2073. end
  2074. return playAnimation("hold")
  2075. end
  2076. if format == "unequip" then
  2077. Mode = 0
  2078. if Attachment == true then
  2079. Player.Character[Name].Laser.Transparency = 1
  2080. Player.Character[Name].Light.Transparency = 1
  2081. end
  2082. Player.Character.Humanoid.WalkSpeed = 16
  2083. for i = 1, 0.01, -0.1 do
  2084. if Player.Character:FindFirstChild("Torso") ~= nil then
  2085. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2086. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2087. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new((-0.5 * i) + (1.5 * (1 - i)), 1.2 * i, 0.8 * i) * CFrame.fromEulerAnglesXYZ(math.rad(300 + ((1 - i) * 50)), math.rad(10), math.rad(-90) * i)
  2088. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2089. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new((-0.9 * i) + (-1.5 * (1 - i)), -0.35 * i, 0.51 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90 * i), math.rad(-5 * i), 0)
  2090. wait()
  2091. else return false end
  2092. else return false end
  2093. end
  2094. return true
  2095. end
  2096. if format == "hold" then
  2097. if Player.Character:FindFirstChild("Torso") ~= nil then
  2098. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2099. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2100. 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))
  2101. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2102. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  2103. else return false end
  2104. else return false end
  2105. end
  2106. if format == "reload" then
  2107. for i = 5, 0, -1 do
  2108. if Player.Character:FindFirstChild("Torso") ~= nil then
  2109. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2110. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2111. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.3, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  2112. wait()
  2113. else return false end
  2114. else return false end
  2115. end
  2116. coroutine.resume(coroutine.create(function()
  2117. for i = 0, 25, 5 do
  2118. if Player.Character:FindFirstChild("Torso") ~= nil then
  2119. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2120. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2121. 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)
  2122. wait()
  2123. else return false end
  2124. else return false end
  2125. end
  2126. end))
  2127. Player.Character[Name].Handle.Release:Play()
  2128. Player.Character[Name].Magazine.Transparency = 1
  2129. Player.Character[Name].MagPull1.Transparency = 1
  2130. Player.Character[Name].MagPull2.Transparency = 1
  2131. local Mag = Instance.new("Model")
  2132. Mag.Name = "Spent Magazine"
  2133. local source = Player.Character[Name]:FindFirstChild("Magazine")
  2134. if source == nil then return end
  2135. source = source:Clone()
  2136. source.CanCollide = true
  2137. source.Transparency = 0
  2138. source.Parent = Mag
  2139. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do source.Transparency = i wait() end source:Remove() end))
  2140. for _, Part in pairs(Player.Character[Name]:GetChildren()) do
  2141. if Part.Name == "MagPull1" or Part.Name == "MagPull2" then
  2142. local new = Part:Clone()
  2143. new.Parent = Mag
  2144. new.Transparency = 0
  2145. new.CanCollide = true
  2146. local w = Instance.new("Weld", new)
  2147. w.Part0 = w.Parent
  2148. w.Part1 = source
  2149. w.C0 = Part.Weld.C0
  2150. w.C1 = Part.Weld.C1
  2151. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do new.Transparency = i wait() end new:Remove() end))
  2152. else end
  2153. end
  2154. Mag.Parent = game.Workspace
  2155. for i = 0, 25, 5 do
  2156. if Player.Character:FindFirstChild("Torso") ~= nil then
  2157. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2158. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2159. 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))
  2160. wait()
  2161. else return false end
  2162. else return false end
  2163. end
  2164. magazineNew = Player.Character[Name].Magazine:Clone()
  2165. magazineNew.Name = "New Magazine"
  2166. magazineNew.Transparency = 0
  2167. magazineNew.Parent = Player.Character[Name]
  2168. local w = Instance.new("Weld")
  2169. w.Part0 = magazineNew
  2170. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  2171. w.C0 = CFrame.new(0, 1.1, 0)
  2172. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  2173. w.Parent = magazineNew
  2174. wait(0.2)
  2175. for i = 25, 0, -5 do
  2176. if Player.Character:FindFirstChild("Torso") ~= nil then
  2177. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2178. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2179. 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))
  2180. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2181. 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)))
  2182. wait()
  2183. else return false end
  2184. else return false end
  2185. end
  2186. Player.Character[Name].Magazine.Transparency = 0
  2187. Player.Character[Name].MagPull1.Transparency = 0
  2188. Player.Character[Name].MagPull2.Transparency = 0
  2189. CamShake(1, 30000)
  2190. CamShake(1, -30000)
  2191. Player.Character[Name]["New Magazine"]:Remove()
  2192. wait(0.1)
  2193. if Player.Character:FindFirstChild("Torso") ~= nil then
  2194. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2195. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2196. 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))
  2197. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2198. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  2199. else return false end
  2200. else return false end
  2201. Player.Character[Name].Handle.Reload:Play()
  2202. Player.Character[Name].Handle.Jam:Play()
  2203. wait(0.2)
  2204. if magazine.Value == 0 or Jammed == true then
  2205. playAnimation("charge")
  2206. end
  2207. end
  2208. if format == "charge" then
  2209. Player.Character[Name].Handle.Weld:Remove()
  2210. local w = Instance.new("Weld")
  2211. w.Part0 = Player.Character[Name].Handle
  2212. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  2213. w.C0 = CFrame.new(-0.85, -0.3, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(15), math.rad(90), 0)
  2214. w.C1 = CFrame.new(0, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(40), 0, 0)
  2215. w.Parent = Player.Character[Name].Handle
  2216. if Player.Character:FindFirstChild("Torso") ~= nil then
  2217. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2218. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2219. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.4, 0.9, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(280), math.rad(-10), math.rad(-90))
  2220. else return false end
  2221. else return false end
  2222. wait(0.2)
  2223. Player.Character[Name].Handle.Equip:Play()
  2224. Player.Character[Name].CHandleC.Transparency = 1
  2225. Player.Character[Name].CHandleB.Transparency = 0
  2226. Player.Character[Name].CHandleB1.Transparency = 0
  2227. Player.Character[Name].Bolt.Mesh.Offset = Vector3.new(0, 0.115, 0)
  2228. Player.Character[Name].Bolt.Mesh.Scale = Vector3.new(0.14, 0.1, 0.14)
  2229. Player.Character[Name].DustCover.Mesh.Offset = Vector3.new(0, 0, 0.115)
  2230. Jammed = false
  2231. if magazine.Value ~= 0 then
  2232. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  2233. else end
  2234. for i = 0, 1, 0.25 do
  2235. if Player.Character:FindFirstChild("Torso") ~= nil then
  2236. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2237. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2238. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1.2, 0 - (i / 1.5), 0.9) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  2239. wait()
  2240. else return false end
  2241. else return false end
  2242. end
  2243. wait(0.08)
  2244. Player.Character[Name].CHandleC.Transparency = 0
  2245. Player.Character[Name].CHandleB.Transparency = 1
  2246. Player.Character[Name].CHandleB1.Transparency = 1
  2247. Player.Character[Name].Bolt.Mesh.Offset = Vector3.new(0, 0, 0)
  2248. Player.Character[Name].Bolt.Mesh.Scale = Vector3.new(0.14, 0.3, 0.14)
  2249. wait(0.02)
  2250. removeParts("RightHand")
  2251. makeParts("RightHand")
  2252. Player.Character[Name].DustCover.Mesh.Offset = Vector3.new(0, 0, 0.115)
  2253. playAnimation("hold")
  2254. return true
  2255. end
  2256. if format == "fire" then
  2257. Player.Character[Name].Bolt.Mesh.Offset = Vector3.new(0, 0.115, 0)
  2258. Player.Character[Name].Bolt.Mesh.Scale = Vector3.new(0.14, 0.1, 0.14)
  2259. Player.Character[Name].DustCover.Mesh.Offset = Vector3.new(0, 0, 0.115)
  2260. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  2261. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  2262. if silenced then
  2263. Player.Character[Name].Handle.Fire2.Volume = math.random(8, 10) / 10
  2264. Player.Character[Name].Handle.Fire2.Pitch = math.random(1.8, 2)
  2265. Player.Character[Name].Handle.Fire2:Play()
  2266. CamShake(10, 40000)
  2267. else
  2268. Player.Character[Name].Handle.Fire.Volume = math.random(9, 10) / 10
  2269. Player.Character[Name].Handle.Fire.Pitch = math.random(1.6, 1.8)
  2270. Player.Character[Name].Handle.Fire:Play()
  2271. CamShake(10, 50000)
  2272. end
  2273. else return false end
  2274. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  2275. if silenced == false then
  2276. coroutine.resume(coroutine.create(function() Player.Character[Name].DustCover.Smoke.Enabled = true Player.Character[Name].Muzzle.Smoke.Enabled = true Player.Character[Name].Muzzle.Fire.Enabled = true wait(0.1) Player.Character[Name].DustCover.Smoke.Enabled = false Player.Character[Name].Muzzle.Smoke.Enabled = false Player.Character[Name].Muzzle.Fire.Enabled = false end))
  2277. else end
  2278. else return false end
  2279. for i = 0, 6, 3 do
  2280. if Player.Character:FindFirstChild("Torso") ~= nil then
  2281. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2282. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2283. 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))
  2284. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2285. 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)
  2286. wait()
  2287. else return false end
  2288. else return false end
  2289. end
  2290. if magazine.Value ~= 0 then
  2291. Player.Character[Name].Bolt.Mesh.Offset = Vector3.new(0, 0, 0)
  2292. Player.Character[Name].Bolt.Mesh.Scale = Vector3.new(0.14, 0.3, 0.14)
  2293. elseif magazine.Value == 0 then
  2294. Player.Character[Name].Handle.Lock:Play()
  2295. end
  2296. if math.random(1, Reliability) == 1 then
  2297. Jammed = true
  2298. Player.Character[Name].Handle.Jam:Play()
  2299. end
  2300. for i = 6, 0, -3 do
  2301. if Player.Character:FindFirstChild("Torso") ~= nil then
  2302. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2303. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2304. 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))
  2305. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2306. 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)
  2307. wait()
  2308. else return false end
  2309. else return false end
  2310. end
  2311. end
  2312. if format == "silence" then
  2313. Player.Character[Name].Handle.Jam:Play()
  2314. if Player.Character:FindFirstChild("Torso") ~= nil then
  2315. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2316. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2317. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.6, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  2318. else return false end
  2319. else return false end
  2320. for i = 0, 10, 1.5 do
  2321. if Player.Character:FindFirstChild("Torso") ~= nil then
  2322. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  2323. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2324. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.9, 1.4 - (i / 25), 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  2325. wait()
  2326. end
  2327. end
  2328. end
  2329. for i = 10, 0, -1.5 do
  2330. if Player.Character:FindFirstChild("Torso") ~= nil then
  2331. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  2332. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2333. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.9, 1.4 - (i / 25), 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  2334. wait()
  2335. end
  2336. end
  2337. end
  2338. playAnimation("hold")
  2339. return
  2340. end
  2341. if format == "attachment" then
  2342. Player.Character[Name].Handle.Switch:Play()
  2343. for i = 0, 10, 5 do
  2344. if Player.Character:FindFirstChild("Torso") ~= nil then
  2345. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  2346. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2347. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 - (i / 25), 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 - i), math.rad(-90))
  2348. wait()
  2349. end
  2350. end
  2351. end
  2352. for i = 10, 0, -5 do
  2353. if Player.Character:FindFirstChild("Torso") ~= nil then
  2354. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil then
  2355. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  2356. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.5 - (i / 25), 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300 - i), math.rad(10 - i), math.rad(-90))
  2357. wait()
  2358. end
  2359. end
  2360. end
  2361. end
  2362. if format == "switch" then
  2363. for i = 10, 0, -3 do
  2364. if Player.Character:FindFirstChild("Torso") ~= nil then
  2365. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  2366. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  2367. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-1 + (i / 30), -0.35, 0.51 + (i / 25)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), math.rad((25 * 2) - ((25 - i) * 2)))
  2368. wait()
  2369. else return false end
  2370. else return false end
  2371. end
  2372. end
  2373. return true
  2374. end
  2375.  
  2376.  
  2377. function CamShake(time, freq)
  2378. coroutine.resume(coroutine.create(function()
  2379. local cam = game:GetService("Workspace").CurrentCamera
  2380. local time = 10
  2381. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  2382. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  2383. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  2384. 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)
  2385. for i = 1, time do
  2386. 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)
  2387. wait()
  2388. end
  2389. end))
  2390. end
  2391.  
  2392.  
  2393. function makeShell(part)
  2394. if part == nil then return false end
  2395. local casing = Instance.new("Part")
  2396. casing.Name = "Shell"
  2397. casing.formFactor = "Custom"
  2398. casing.Size = Vector3.new(0.2, 0.25, 0.2)
  2399. 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)))
  2400. casing.BrickColor = BrickColor.new("New Yeller")
  2401. local mesh = Instance.new("CylinderMesh")
  2402. mesh.Scale = Vector3.new(0.3, 1, 0.3)
  2403. mesh.Parent = casing
  2404. casing.Parent = game:GetService("Workspace")
  2405. casing:BreakJoints()
  2406. casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
  2407. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  2408. end
  2409.  
  2410.  
  2411. function Weld(x, y)
  2412. local weld = Instance.new("Weld")
  2413. weld.Part0 = x
  2414. weld.Part1 = y
  2415. CJ = CFrame.new(x.Position)
  2416. C0 = x.CFrame:inverse() * CJ
  2417. C1 = y.CFrame:inverse() * CJ
  2418. weld.C0 = C0
  2419. weld.C1 = C1
  2420. weld.Parent = x
  2421. end
  2422.  
  2423.  
  2424. function tagHumanoid(humanoid)
  2425. local tag = Instance.new("ObjectValue")
  2426. tag.Name = "creator"
  2427. tag.Value = Player
  2428. tag.Parent = humanoid
  2429. local tag = Instance.new("StringValue")
  2430. tag.Name = "creatorType1"
  2431. tag.Value = Name
  2432. tag.Parent = humanoid
  2433. local tag = Instance.new("StringValue")
  2434. tag.Name = "creatorType2"
  2435. tag.Value = "shot"
  2436. tag.Parent = humanoid
  2437. end
  2438.  
  2439.  
  2440. function untagHumanoid(humanoid)
  2441. if humanoid ~= nil then
  2442. local tag = humanoid:FindFirstChild("creator")
  2443. if tag ~= nil then
  2444. tag:Remove()
  2445. end
  2446. local tag = humanoid:FindFirstChild("creatorType1")
  2447. if tag ~= nil then
  2448. tag:Remove()
  2449. end
  2450. local tag = humanoid:FindFirstChild("creatorType2")
  2451. if tag ~= nil then
  2452. tag:Remove()
  2453. end
  2454. end
  2455. end
  2456.  
  2457.  
  2458. function fire(startPoint, endPoint, hit)
  2459. local trail = Instance.new("Part")
  2460. trail.Name = "Bullet Trail"
  2461. trail.BrickColor = BrickColor.new("Dark stone grey")
  2462. trail.TopSurface = 0
  2463. trail.BottomSurface = 0
  2464. trail.formFactor = 0
  2465. trail.Size = Vector3.new(1, 1, 1)
  2466. trail.Transparency = 0.5
  2467. trail.Anchored = true
  2468. trail.CanCollide = false
  2469. trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  2470. trail.Parent = game:GetService("Workspace")
  2471. local mesh = Instance.new("SpecialMesh")
  2472. mesh.MeshType = "Brick"
  2473. mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
  2474. mesh.Parent = trail
  2475. 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)
  2476. if hit ~= nil then
  2477. if hit.Parent == nil then return end
  2478. if hit.Parent.ClassName == "Hat" then
  2479. if hit.Parent.Parent.Humanoid ~= nil then
  2480. hit.Parent.Parent.Humanoid:TakeDamage(damage * 5)
  2481. end
  2482. end
  2483. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  2484. tagHumanoid(hit.Parent.Humanoid)
  2485. if hit.Name == "Head" then
  2486. hit.Parent.Humanoid:TakeDamage(damage * 10)
  2487. elseif hit.Name == "Torso" then
  2488. hit.Parent.Humanoid:TakeDamage(damage * 2)
  2489. elseif hit.Name == "Left Leg" then
  2490. hit.Parent.Humanoid:TakeDamage(damage)
  2491. hit.Parent.Humanoid.Sit = true
  2492. elseif hit.Name == "Right Leg" then
  2493. hit.Parent.Humanoid:TakeDamage(damage)
  2494. hit.Parent.Humanoid.Sit = true
  2495. else
  2496. hit.Parent.Humanoid:TakeDamage(damage)
  2497. end
  2498. if math.random(1, 10) == 1 then
  2499. hit.Parent.Humanoid.Sit = true
  2500. end
  2501. delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  2502. end
  2503. if hit.Anchored == false then
  2504. hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
  2505. end
  2506. end
  2507. end
  2508.  
  2509.  
  2510. function onButton1Down(mouse)
  2511. if selected == false then return end
  2512. 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
  2513. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  2514. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  2515. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  2516. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  2517. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  2518. Button1Down = true
  2519. canFire = false
  2520. canFire2 = true
  2521. while canFire2 == true do
  2522. local humanoid = Player.Character:FindFirstChild("Humanoid")
  2523. if humanoid == nil then
  2524. canFire2 = false
  2525. break
  2526. end
  2527. if humanoid.Health <= 0 then
  2528. canFire2 = false
  2529. break
  2530. end
  2531. local fireLeft = false
  2532. if automatic == false and burst == false then
  2533. canFire2 = false
  2534. elseif automatic == false and burst == true then
  2535. if burstCount >= burstCountMax then
  2536. canFire2 = false
  2537. burstCount = 0
  2538. break
  2539. end
  2540. burstCount = burstCount + 1
  2541. elseif automatic == true and burst == false then
  2542. fireLeft = true
  2543. end
  2544. if Jammed ~= true then
  2545. if magazine.Value > 0 then
  2546. magazine.Value = magazine.Value - 1
  2547. updateGui()
  2548. if silenced == true then
  2549. CamShake(1, Spread)
  2550. else end
  2551. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  2552. coroutine.resume(coroutine.create(function()
  2553. if dual == true then
  2554. playAnimation("rightFire")
  2555. elseif dual == false then
  2556. playAnimation("fire")
  2557. end
  2558. end))
  2559. else
  2560. Player.Character[Name].Handle.Empty:Play()
  2561. end
  2562. else
  2563. Player.Character[Name].Handle.Jam:Play()
  2564. end
  2565. if fireLeft == true and dual == true and automatic == true then
  2566. if magazine.Value > 0 then
  2567. coroutine.resume(coroutine.create(function()
  2568. wait(readyTime / 2)
  2569. magazine.Value = magazine.Value - 1
  2570. updateGui()
  2571. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  2572. playAnimation("leftFire")
  2573. end))
  2574. else
  2575. coroutine.resume(coroutine.create(function()
  2576. wait(readyTime / 2)
  2577. Player.Character[Name].Handle.Empty:Play()
  2578. end))
  2579. end
  2580. end
  2581. wait(readyTime)
  2582. end
  2583. if magazine.Value ~= 0 then
  2584. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  2585. else end
  2586. canFire = true
  2587. end
  2588. end
  2589.  
  2590.  
  2591. function onButton1Up(mouse)
  2592. if selected == false then return end
  2593. Button1Down = false
  2594. canFire2 = false
  2595. burstCount = 0
  2596. while canFire == false do wait() end
  2597. if dual == true and automatic == false then
  2598. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  2599. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  2600. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  2601. canFire = false
  2602. canFire2 = true
  2603. while canFire2 == true do
  2604. local humanoid = Player.Character:FindFirstChild("Humanoid")
  2605. if humanoid == nil then
  2606. canFire2 = false
  2607. break
  2608. end
  2609. if humanoid.Health <= 0 then
  2610. canFire2 = false
  2611. break
  2612. end
  2613. if burst == false then
  2614. canFire2 = false
  2615. elseif burst == true then
  2616. if burstCount >= burstCountMax then
  2617. canFire2 = false
  2618. burstCount = 0
  2619. break
  2620. end
  2621. burstCount = burstCount + 1
  2622. end
  2623. if magazine.Value <= 0 then
  2624. Player.Character[Name].Handle.Empty:Play()
  2625. else
  2626. coroutine.resume(coroutine.create(function()
  2627. playAnimation("leftFire")
  2628. end))
  2629. magazine.Value = magazine.Value - 1
  2630. updateGui()
  2631. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  2632. end
  2633. wait(readyTime)
  2634. end
  2635. if magazine.Value ~= 0 then
  2636. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  2637. else end
  2638. canFire = true
  2639. end
  2640. end
  2641.  
  2642.  
  2643. function onKeyDown(key, mouse)
  2644. if selected == false then return end
  2645. key = key:lower()
  2646. if key == "q" and Button1Down == false and canFire == true then
  2647. if mouse.Target == nil then return end
  2648. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  2649. if dual == true then onKeyDown("t", mouse) end
  2650. onDeselected(mouse)
  2651. removeParts("RightHolster")
  2652. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  2653. end
  2654. end
  2655. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  2656. canFire = false
  2657. if silenced then
  2658. playAnimation("silence")
  2659. silenced = false
  2660. if Player.Character:FindFirstChild(Name) == nil then return end
  2661. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  2662. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  2663. Player.Character[Name].Muzzle.Transparency = 1
  2664. Player.Character[Name].Silencer1.Transparency = 1
  2665. Player.Character[Name].Silencer2.Transparency = 1
  2666. Player.Character[Name].Muzzle.Name = "Silencer"
  2667. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  2668. if dual == true then
  2669. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  2670. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  2671. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  2672. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  2673. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  2674. end
  2675. else
  2676. playAnimation("silence")
  2677. silenced = true
  2678. if Player.Character:FindFirstChild(Name) == nil then return end
  2679. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  2680. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  2681. Player.Character[Name].Silencer.Transparency = 0
  2682. Player.Character[Name].Silencer1.Transparency = 0
  2683. Player.Character[Name].Silencer2.Transparency = 0
  2684. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  2685. Player.Character[Name].Silencer.Name = "Muzzle"
  2686. if dual == true then
  2687. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  2688. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  2689. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  2690. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  2691. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  2692. end
  2693. end
  2694. canFire = true
  2695. end
  2696. if key == "r" and Button1Down == false and canFire == true then
  2697. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value + 1 then
  2698. canFire = false
  2699. burstCount = 0
  2700. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  2701. if magazine.Value > 0 then magazine.Value = 1 end
  2702. updateGui()
  2703. if dual == true then
  2704. playAnimation("reloadDual")
  2705. elseif dual == false then
  2706. playAnimation("reload")
  2707. end
  2708. if ammo.Value - magazineMax.Value < 0 then
  2709. magazine.Value = ammo.Value
  2710. ammo.Value = 0
  2711. elseif ammo.Value - magazineMax.Value >= 0 then
  2712. ammo.Value = ammo.Value - magazineMax.Value
  2713. magazine.Value = magazine.Value + magazineMax.Value
  2714. end
  2715. updateGui()
  2716. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  2717. canFire = true
  2718. end
  2719. end
  2720. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  2721. canFire = false
  2722. if dual == false then
  2723. local weapon = nil
  2724. for _, p in pairs(Player.Backpack:GetChildren()) do
  2725. if p.Name == Name and p ~= script.Parent then weapon = p break end
  2726. end
  2727. if weapon ~= nil then
  2728. dual = true
  2729. weapon.Name = "Dual"
  2730. weapon.Parent = script
  2731. silenced = false
  2732. removeParts("RightHand")
  2733. makeParts("RightHand")
  2734. removeParts("RightHolster")
  2735. makeParts("LeftHolster")
  2736. playAnimation("leftEquip")
  2737. removeParts("LeftHolster")
  2738. makeParts("LeftHand")
  2739. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  2740. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  2741. magazine.Value = magazine.Value + weapon.Magazine.Value
  2742. ammo.Value = ammo.Value + weapon.Ammo.Value
  2743. updateGui()
  2744. end
  2745. elseif dual == true then
  2746. local weapon = script:FindFirstChild("Dual")
  2747. if weapon ~= nil then
  2748. dual = false
  2749. weapon.Name = Name
  2750. weapon.Parent = Player.Backpack
  2751. silenced = false
  2752. removeParts("RightHand")
  2753. makeParts("RightHand")
  2754. playAnimation("leftUnequip")
  2755. removeParts("LeftHand")
  2756. makeParts("RightHolster")
  2757. playAnimation("hold")
  2758. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  2759. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  2760. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  2761. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  2762. magazine.Value = math.ceil(magazine.Value / 2)
  2763. ammo.Value = math.ceil(ammo.Value / 2)
  2764. updateGui()
  2765. end
  2766. end
  2767. canFire = true
  2768. end
  2769. if key == "y" and canZoom == true then
  2770. if zoom == false then
  2771. zoom = true
  2772. local pos = mouse.Hit.p
  2773. local target = mouse.Target
  2774. local cam = game:GetService("Workspace").CurrentCamera
  2775. focus = Instance.new("Part", workspace)
  2776. focus.Anchored = true
  2777. focus.CanCollide = false
  2778. focus.Transparency = 1
  2779. focus.TopSurface = 0
  2780. focus.BottomSurface = 0
  2781. focus.formFactor = "Plate"
  2782. focus.Size = Vector3.new(0, 0, 0)
  2783. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  2784. cam.CameraSubject = focus
  2785. cam.CameraType = "Attach"
  2786. while zoom == true and selected == true do
  2787. local set = false
  2788. if target ~= nil then
  2789. if target.Parent ~= nil then
  2790. if target.Anchored == false then
  2791. 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)
  2792. set = true
  2793. end
  2794. end
  2795. end
  2796. if set == false then
  2797. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  2798. end
  2799. wait()
  2800. end
  2801. if focus ~= nil then focus:Remove() focus = nil end
  2802. local cam = game:GetService("Workspace").CurrentCamera
  2803. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  2804. cam.CameraType = "Custom"
  2805. else
  2806. zoom = false
  2807. end
  2808. end
  2809. if key == "u" and Button1Down == false and canFire == true then
  2810. playAnimation("switch")
  2811. if automatic == false and burst == false then
  2812. if switchToBurst == true then
  2813. burst = true
  2814. local m = Instance.new("Message", Player)
  2815. m.Text = "Burst"
  2816. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  2817. delay(2.5, function() m:Remove() end)
  2818. elseif switchToAutomatic == true then
  2819. automatic = true
  2820. local m = Instance.new("Message", Player)
  2821. m.Text = "Automatic"
  2822. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  2823. delay(2.5, function() m:Remove() end)
  2824. end
  2825. elseif automatic == false and burst == true then
  2826. if switchToAutomatic == true then
  2827. automatic = true
  2828. burst = false
  2829. local m = Instance.new("Message", Player)
  2830. m.Text = "Automatic"
  2831. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  2832. delay(2.5, function() m:Remove() end)
  2833. elseif switchToSingle == true then
  2834. burst = false
  2835. local m = Instance.new("Message", Player)
  2836. m.Text = "Single"
  2837. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  2838. delay(2.5, function() m:Remove() end)
  2839. end
  2840. elseif automatic == true and burst == false then
  2841. if switchToSingle == true then
  2842. automatic = false
  2843. local m = Instance.new("Message", Player)
  2844. m.Text = "Single"
  2845. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  2846. delay(2.5, function() m:Remove() end)
  2847. elseif switchToBurst == true then
  2848. automatic = false
  2849. burst = true
  2850. local m = Instance.new("Message", Player)
  2851. m.Text = "Burst"
  2852. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  2853. delay(2.5, function() m:Remove() end)
  2854. end
  2855. end
  2856. end
  2857. if key == "f" and Button1Down == false and canFire == true and Attachment == true and dual == false then
  2858. playAnimation("attachment")
  2859. if Mode == 1 and Mode ~= 2 and Mode ~= 0 then
  2860. Player.Character[Name].Handle.Switch:Play()
  2861. Player.Character[Name].Laser.Transparency = 1
  2862. Player.Character[Name].Light.Transparency = 0.5
  2863. Mode = 2
  2864. elseif Mode == 2 and Mode ~= 1 and Mode ~= 0 then
  2865. Player.Character[Name].Handle.Switch:Play()
  2866. Player.Character[Name].Laser.Transparency = 1
  2867. Player.Character[Name].Light.Transparency = 1
  2868. Mode = 0
  2869. elseif Mode == 0 and Mode ~= 1 and Mode ~= 2 then
  2870. Player.Character[Name].Handle.Switch:Play()
  2871. Player.Character[Name].Laser.Transparency = 0.4
  2872. Player.Character[Name].Light.Transparency = 1
  2873. Mode = 1
  2874. end
  2875. else end
  2876. if key == "c" and Button1Down == false and canFire == true then
  2877. if magazine.Value ~= 0 then
  2878. canFire = false
  2879. burstCount = 0
  2880. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  2881. if magazine.Value ~= 0 then magazine.Value = magazine.Value - 1 end
  2882. updateGui()
  2883. playAnimation("charge")
  2884. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  2885. canFire = true
  2886. end
  2887. end
  2888. end
  2889.  
  2890.  
  2891. function onSelected(mouse)
  2892. if selected == true then return end
  2893. selected = true
  2894. canFire = false
  2895. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  2896. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  2897. if Player.Character.WeaponActivated.Value == nil then break end
  2898. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  2899. wait()
  2900. end
  2901. updateGui()
  2902. local weapon = Instance.new("ObjectValue")
  2903. weapon.Name = "WeaponActivated"
  2904. weapon.Value = script.Parent
  2905. weapon.Parent = Player.Character
  2906. DisableLimb(1, Player.Character)
  2907. DisableLimb(2, Player.Character)
  2908. ForceAngle(1, 0, Player.Character)
  2909. ForceAngle(2, 0, Player.Character)
  2910. if dual == true then
  2911. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  2912. playAnimation("rightEquip")
  2913. removeParts("LeftHolster")
  2914. makeParts("LeftHand")
  2915. else
  2916. playAnimation("equip")
  2917. end
  2918. removeParts("RightHolster")
  2919. makeParts("RightHand")
  2920. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  2921. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  2922. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  2923. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  2924. canFire = true
  2925. end
  2926.  
  2927.  
  2928. function onDeselected(mouse)
  2929. if selected == false then return end
  2930. Button1Down = false
  2931. while canFire == false do
  2932. wait()
  2933. end
  2934. selected = false
  2935. if dual == true then
  2936. if math.random(1, 2) == 1 then
  2937. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  2938. wait(math.random(1, 10) / 10)
  2939. playAnimation("rightUnequip")
  2940. else
  2941. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  2942. wait(math.random(1, 10) / 10)
  2943. playAnimation("leftUnequip")
  2944. end
  2945. removeParts("LeftHand")
  2946. makeParts("LeftHolster")
  2947. else
  2948. playAnimation("unequip")
  2949. end
  2950. removeParts("RightHand")
  2951. makeParts("RightHolster")
  2952. ForceAngle(1, 0, Player.Character)
  2953. ForceAngle(2, 0, Player.Character)
  2954. ResetLimbCFrame(1, Player.Character)
  2955. ResetLimbCFrame(2, Player.Character)
  2956. EnableLimb(1, Player.Character)
  2957. EnableLimb(2, Player.Character)
  2958. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  2959. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  2960. if Player.Character.WeaponActivated.Value == script.Parent then
  2961. Player.Character.WeaponActivated:Remove()
  2962. end
  2963. end
  2964. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  2965. if Player.Character.WeaponActivated.Value == nil then break end
  2966. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  2967. wait()
  2968. end
  2969. end
  2970.  
  2971.  
  2972. if script.Parent.ClassName ~= "HopperBin" then
  2973. if Player == nil then print("Error: Player not found!") return end
  2974. Tool = Instance.new("HopperBin")
  2975. Tool.Name = Name
  2976. Tool.Parent = Player.Backpack
  2977. script.Name = "Main"
  2978. script.Parent = Tool
  2979. end wait() if script.Parent.ClassName == "HopperBin" then
  2980. while script.Parent.Parent.ClassName ~= "Backpack" do
  2981. wait()
  2982. end
  2983. if script.Parent:FindFirstChild("MagazineMax") == nil then
  2984. magazineMax = Instance.new("NumberValue")
  2985. magazineMax.Name = "MagazineMax"
  2986. if Magazine == "STANAG" then
  2987. magazineMax.Value = 30
  2988. elseif Magazine == "Beta-C" then
  2989. magazineMax.Value = 100
  2990. else end
  2991. magazineMax.Parent = script.Parent
  2992. else
  2993. magazineMax = script.Parent.MagazineMax
  2994. end
  2995. if script.Parent:FindFirstChild("Magazine") == nil then
  2996. magazine = Instance.new("NumberValue")
  2997. magazine.Name = "Magazine"
  2998. magazine.Value = 0
  2999. magazine.Parent = script.Parent
  3000. else
  3001. magazine = script.Parent.Magazine
  3002. end
  3003. if script.Parent:FindFirstChild("AmmoMax") == nil then
  3004. ammoMax = Instance.new("NumberValue")
  3005. ammoMax.Name = "AmmoMax"
  3006. if Magazine == "STANAG" then
  3007. ammoMax.Value = 180
  3008. elseif Magazine == "Beta-C" then
  3009. ammoMax.Value = 300
  3010. else end
  3011. ammoMax.Parent = script.Parent
  3012. else
  3013. ammoMax = script.Parent.AmmoMax
  3014. end
  3015. if script.Parent:FindFirstChild("Ammo") == nil then
  3016. ammo = Instance.new("NumberValue")
  3017. ammo.Name = "Ammo"
  3018. ammo.Value = script.Parent.AmmoMax.Value
  3019. ammo.Parent = script.Parent
  3020. else
  3021. ammo = script.Parent.Ammo
  3022. end
  3023. Player = script.Parent.Parent.Parent
  3024. makeParts("RightHolster")
  3025. script.Parent.Selected:connect(onSelected)
  3026. script.Parent.Deselected:connect(onDeselected)
  3027. end
Add Comment
Please, Sign In to add comment