Advertisement
jassm11

Untitled

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