Advertisement
Guest User

Untitled

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