Advertisement
KHSora455

M4A1

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