gamerfly

m4

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