Advertisement
Doomix

M4AI

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