Advertisement
brianspy

Untitled

Sep 30th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.54 KB | None | 0 0
  1. if script == nil then return end
  2.  
  3.  
  4. Player = script:FindFirstChild("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("yfc")
  5. Name = "M249"
  6. MC = BrickColor.new("Black")
  7. DC = BrickColor.new("Black")
  8. GC = BrickColor.new("Dark stone grey")
  9. MR = 0
  10. GR = 0
  11. Holstered = true
  12. Spread = 90000
  13. WSPenalty = 10
  14. selected = false
  15. canDual = false
  16. dual = false
  17. Button1Down = false
  18. damage = 18
  19. canFire = true
  20. canFire2 = false
  21. readyTime = 0.1
  22. automatic = true
  23. burst = false
  24. burstCount = 0
  25. burstCountMax = 3
  26. canSilence = true
  27. silenced = false
  28. canZoom = false
  29. zoom = false
  30. switchToSingle = true
  31. switchToBurst = false
  32. switchToAutomatic = true
  33.  
  34.  
  35. ammoGui = Instance.new("ScreenGui")
  36. ammoGui.Name = Name
  37. local frame = Instance.new("Frame")
  38. frame.Name = "Frame"
  39. frame.Size = UDim2.new(0, 165, 0, 60)
  40. frame.Position = UDim2.new(0, 0, 1, -400)
  41. frame.BackgroundColor3 = Color3.new(1, 1, 1)
  42. frame.BorderColor3 = Color3.new(0, 0, 0)
  43. frame.Parent = ammoGui
  44. local label = Instance.new("TextLabel")
  45. label.Name = "Weapon"
  46. label.Text = "Weapon: " ..Name
  47. label.Size = UDim2.new(1, 0, 0, 20)
  48. label.Position = UDim2.new(0, 0, 0, 0)
  49. label.BackgroundColor3 = Color3.new(1, 0, 0)
  50. label.BorderColor3 = Color3.new(0, 0, 0)
  51. label.Parent = frame
  52. local label = Instance.new("TextLabel")
  53. label.Name = "MagazinePrefix"
  54. label.Text = " Magazine:"
  55. label.TextXAlignment = "Left"
  56. label.Size = UDim2.new(1, 0, 0, 20)
  57. label.Position = UDim2.new(0, 0, 0, 20)
  58. label.BackgroundColor3 = Color3.new(1, 1, 1)
  59. label.BorderColor3 = Color3.new(0, 0, 0)
  60. label.Parent = frame
  61. local label = Instance.new("TextLabel")
  62. label.Name = "Magazine"
  63. label.Text = "0/0"
  64. label.TextXAlignment = "Right"
  65. label.Size = UDim2.new(1, 0, 0, 20)
  66. label.Position = UDim2.new(0, -10, 0, 20)
  67. label.BackgroundTransparency = 1
  68. label.BorderSizePixel = 0
  69. label.Parent = frame
  70. local label = Instance.new("TextLabel")
  71. label.Name = "AmmoPrefix"
  72. label.Text = " 5.56x45mm NATO:"
  73. label.TextXAlignment = "Left"
  74. label.Size = UDim2.new(1, 0, 0, 20)
  75. label.Position = UDim2.new(0, 0, 0, 40)
  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 = "Ammo"
  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, 40)
  85. label.BackgroundTransparency = 1
  86. label.BorderSizePixel = 0
  87. label.Parent = frame
  88.  
  89.  
  90. function updateGui()
  91. if selected == false then return end
  92. if Player:FindFirstChild("PlayerGui") == nil then Instance.new("PlayerGui").Parent = Player end
  93. if Player.PlayerGui:FindFirstChild(Name) == nil then
  94. ammoGui:Clone().Parent = Player.PlayerGui
  95. end
  96. Player.PlayerGui[Name].Frame.Magazine.Text = tostring(magazine.Value).. "/" ..tostring(magazineMax.Value)
  97. Player.PlayerGui[Name].Frame.Ammo.Text = tostring(ammo.Value).. "/" ..tostring(ammoMax.Value)
  98. end
  99.  
  100.  
  101. function makeParts(format)
  102. local model = Instance.new("Model")
  103. model.Name = Name
  104. local pm = Instance.new("Part")
  105. pm.Name = "Handle"
  106. pm.formFactor = "Symmetric"
  107. pm.Size = Vector3.new(1, 1, 1)
  108. pm.BrickColor = MC
  109. pm.Reflectance = MR
  110. pm.CanCollide = false
  111. pm.Locked = true
  112. pm.TopSurface = 0
  113. pm.BottomSurface = 0
  114. pm.Parent = model
  115. local m = Instance.new("BlockMesh")
  116. m.Scale = Vector3.new(0.35, 1.4, 0.41)
  117. m.Offset = Vector3.new(0, 0.01, 0.07)
  118. m.Parent = pm
  119. if format ~= nil then
  120. local w = Instance.new("Weld")
  121. w.Part0 = pm
  122. if format == "RightHand" then
  123. w.Part1 = Player.Character:FindFirstChild("Right Arm")
  124. w.C0 = CFrame.new(0, 1.15, 0.7)
  125. w.C1 = CFrame.new()
  126. elseif format == "RightHolster" then
  127. w.Part1 = Player.Character:FindFirstChild("Torso")
  128. w.C0 = CFrame.new(-0.65, 0, 0) * CFrame.fromEulerAnglesXYZ(math.rad(-40), math.rad(90), 0)
  129. w.C1 = CFrame.new()
  130. model.Name = Name.. " (Holstered)"
  131. end
  132. w.Parent = pm
  133. model.Parent = Player.Character
  134. end
  135. --[[
  136. sniper1 http://www.roblox.com/asset/?id=1868836
  137. equip http://www.roblox.com/asset/?id=13510737
  138. fire1 http://www.roblox.com/asset/?id=2760979
  139. fire2 http://www.roblox.com/asset/?id=13510352
  140. fire3 http://www.roblox.com/asset/?id=2692806
  141. fire4 http://www.roblox.com/asset/?id=2691586
  142. fire5 http://www.roblox.com/asset/?id=2920959
  143. fire6 http://www.roblox.com/asset/?id=2697431
  144. fire7 http://www.roblox.com/asset/?id=2920959
  145. reload1 http://www.roblox.com/asset/?id=2691591
  146. reload2 http://www.roblox.com/asset/?id=2697432
  147. reload3 http://www.roblox.com/asset/?id=2920960
  148. reload4 http://www.roblox.com/asset/?id=2761842
  149. shotgun1 http://www.roblox.com/asset/?id=2697294
  150. --]]
  151. local s = Instance.new("Sound")
  152. s.Name = "Fire"
  153. s.SoundId = "http://www.roblox.com/Asset/?id=10209798"
  154. s.Volume = 1
  155. s.Pitch = 1.8
  156. s.Looped = false
  157. s.Parent = pm
  158. local s = Instance.new("Sound")
  159. s.Name = "Fire2"
  160. s.SoundId = "http://www.roblox.com/Asset/?id=16211041"
  161. s.Volume = 1
  162. s.Pitch = 3
  163. s.Looped = false
  164. s.Parent = pm
  165. local s = Instance.new("Sound")
  166. s.Name = "Lock"
  167. s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
  168. s.Volume = 1
  169. s.Pitch = 3
  170. s.Looped = false
  171. s.Parent = pm
  172. local s = Instance.new("Sound")
  173. s.Name = "Release"
  174. s.SoundId = "http://www.roblox.com/Asset/?id=10209813"
  175. s.Volume = 1
  176. s.Pitch = 4
  177. s.Looped = false
  178. s.Parent = pm
  179. local s = Instance.new("Sound")
  180. s.Name = "Reload"
  181. s.SoundId = "http://www.roblox.com/asset/?id=2761842"
  182. s.Volume = 1
  183. s.Pitch = 1.1
  184. s.Looped = false
  185. s.Parent = pm
  186. local s = Instance.new("Sound")
  187. s.Name = "Empty"
  188. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  189. s.Volume = 1
  190. s.Pitch = 5
  191. s.Looped = false
  192. s.Parent = pm
  193. local s = Instance.new("Sound")
  194. s.Name = "Switch"
  195. s.SoundId = "http://www.roblox.com/asset/?id=2697295"
  196. s.Volume = 1
  197. s.Pitch = 10
  198. s.Looped = false
  199. s.Parent = pm
  200. local s = Instance.new("Sound")
  201. s.Name = "Equip"
  202. s.SoundId = "http://www.roblox.com/Asset/?id=10209845"
  203. s.Volume = 1
  204. s.Pitch = 1.2
  205. s.Looped = false
  206. s.Parent = pm
  207. local p = Instance.new("Part")
  208. p.Name = "ShellOut"
  209. p.formFactor = "Symmetric"
  210. p.Size = Vector3.new(1, 1, 1)
  211. p.Transparency = 1
  212. p.Locked = true
  213. p.CanCollide = false
  214. p.TopSurface = 0
  215. p.BottomSurface = 0
  216. p.Parent = model
  217. local w = Instance.new("Weld")
  218. w.Part0 = p
  219. w.Part1 = pm
  220. w.C0 = CFrame.new(0, 0.46, 1) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  221. w.C1 = CFrame.new()
  222. w.Parent = p
  223. local p = Instance.new("Part")
  224. p.Name = "Grip"
  225. p.formFactor = "Symmetric"
  226. p.Size = Vector3.new(1, 1, 1)
  227. p.BrickColor = MC
  228. p.Reflectance = MR
  229. p.CanCollide = false
  230. p.Locked = true
  231. p.TopSurface = 0
  232. p.BottomSurface = 0
  233. p.Parent = model
  234. local m = Instance.new("BlockMesh")
  235. m.Scale = Vector3.new(0.29, 0.38, 0.8)
  236. m.Parent = p
  237. local w = Instance.new("Weld")
  238. w.Part0 = p
  239. w.Part1 = pm
  240. w.C0 = CFrame.new(0, -0.15, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(15), 0, 0)
  241. w.C1 = CFrame.new()
  242. w.Parent = p
  243. local p = Instance.new("Part")
  244. p.Name = "Body"
  245. p.formFactor = "Symmetric"
  246. p.Size = Vector3.new(1, 1, 1)
  247. p.BrickColor = MC
  248. p.Reflectance = MR
  249. p.CanCollide = false
  250. p.Locked = true
  251. p.TopSurface = 0
  252. p.BottomSurface = 0
  253. p.Parent = model
  254. local m = Instance.new("BlockMesh")
  255. m.Scale = Vector3.new(0.35, 0.3, 0.44)
  256. m.Parent = p
  257. local w = Instance.new("Weld")
  258. w.Part0 = p
  259. w.Part1 = pm
  260. w.C0 = CFrame.new(0, -0.56, -0.06)
  261. w.C1 = CFrame.new()
  262. w.Parent = p
  263. local p = Instance.new("Part")
  264. p.Name = "Rearsight"
  265. p.formFactor = "Symmetric"
  266. p.Size = Vector3.new(1, 1, 1)
  267. p.BrickColor = MC
  268. p.Reflectance = MR
  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.08, 0.2, 0.44)
  276. m.Offset = Vector3.new(0.12, 0, 0)
  277. m.Parent = p
  278. local w = Instance.new("Weld")
  279. w.Part0 = p
  280. w.Part1 = pm
  281. w.C0 = CFrame.new(0, -0.56, 0)
  282. w.C1 = CFrame.new()
  283. w.Parent = p
  284. local p = Instance.new("Part")
  285. p.Name = "Rearsight"
  286. p.formFactor = "Symmetric"
  287. p.Size = Vector3.new(1, 1, 1)
  288. p.BrickColor = MC
  289. p.Reflectance = MR
  290. p.CanCollide = false
  291. p.Locked = true
  292. p.TopSurface = 0
  293. p.BottomSurface = 0
  294. p.Parent = model
  295. local m = Instance.new("BlockMesh")
  296. m.Scale = Vector3.new(0.08, 0.2, 0.44)
  297. m.Offset = Vector3.new(-0.12, 0, 0)
  298. m.Parent = p
  299. local w = Instance.new("Weld")
  300. w.Part0 = p
  301. w.Part1 = pm
  302. w.C0 = CFrame.new(0, -0.56, 0)
  303. w.C1 = CFrame.new()
  304. w.Parent = p
  305. local p = Instance.new("Part")
  306. p.Name = "Frontsight"
  307. p.formFactor = "Symmetric"
  308. p.Size = Vector3.new(1, 1, 1)
  309. p.BrickColor = MC
  310. p.Reflectance = MR
  311. p.CanCollide = false
  312. p.Locked = true
  313. p.TopSurface = 0
  314. p.BottomSurface = 0
  315. p.Parent = model
  316. local m = Instance.new("BlockMesh")
  317. m.Scale = Vector3.new(0.08, 0.1, 0.3)
  318. m.Parent = p
  319. local w = Instance.new("Weld")
  320. w.Part0 = p
  321. w.Part1 = pm
  322. w.C0 = CFrame.new(0, 2, 0.07)
  323. w.C1 = CFrame.new()
  324. w.Parent = p
  325. local p = Instance.new("Part")
  326. p.Name = "Top2C"
  327. p.formFactor = "Symmetric"
  328. p.Size = Vector3.new(1, 1, 1)
  329. p.BrickColor = MC
  330. p.Reflectance = MR
  331. p.CanCollide = false
  332. p.Locked = true
  333. p.TopSurface = 0
  334. p.BottomSurface = 0
  335. p.Parent = model
  336. local m = Instance.new("BlockMesh")
  337. m.Scale = Vector3.new(0.42, 0.46, 0.12)
  338. m.Parent = p
  339. local w = Instance.new("Weld")
  340. w.Part0 = p
  341. w.Part1 = pm
  342. w.C0 = CFrame.new(0.035, 0.46, 0.1)
  343. w.C1 = CFrame.new()
  344. w.Parent = p
  345. local p = Instance.new("Part")
  346. p.Name = "Top2O"
  347. p.formFactor = "Symmetric"
  348. p.Size = Vector3.new(1, 1, 1)
  349. p.BrickColor = MC
  350. p.Reflectance = MR
  351. p.CanCollide = false
  352. p.Transparency = 1
  353. p.Locked = true
  354. p.TopSurface = 0
  355. p.BottomSurface = 0
  356. p.Parent = model
  357. local m = Instance.new("BlockMesh")
  358. m.Scale = Vector3.new(0.42, 0.46, 0.12)
  359. m.Parent = p
  360. local w = Instance.new("Weld")
  361. w.Part0 = p
  362. w.Part1 = pm
  363. w.C0 = CFrame.new(0.035, 0.4, 0.38) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
  364. w.C1 = CFrame.new()
  365. w.Parent = p
  366. local p = Instance.new("Part")
  367. p.Name = "TopC"
  368. p.formFactor = "Symmetric"
  369. p.Size = Vector3.new(1, 1, 1)
  370. p.BrickColor = MC
  371. p.Reflectance = MR
  372. p.CanCollide = false
  373. p.Locked = true
  374. p.TopSurface = 0
  375. p.BottomSurface = 0
  376. p.Parent = model
  377. local m = Instance.new("BlockMesh")
  378. m.Scale = Vector3.new(0.35, 1.1, 0.12)
  379. m.Parent = p
  380. local w = Instance.new("Weld")
  381. w.Part0 = p
  382. w.Part1 = pm
  383. w.C0 = CFrame.new(0, 0.14, 0.1)
  384. w.C1 = CFrame.new()
  385. w.Parent = p
  386. local p = Instance.new("Part")
  387. p.Name = "TopO"
  388. p.formFactor = "Symmetric"
  389. p.Size = Vector3.new(1, 1, 1)
  390. p.BrickColor = MC
  391. p.Reflectance = MR
  392. p.CanCollide = false
  393. p.Transparency = 1
  394. p.Locked = true
  395. p.TopSurface = 0
  396. p.BottomSurface = 0
  397. p.Parent = model
  398. local m = Instance.new("BlockMesh")
  399. m.Scale = Vector3.new(0.35, 1.1, 0.12)
  400. m.Parent = p
  401. local w = Instance.new("Weld")
  402. w.Part0 = p
  403. w.Part1 = pm
  404. w.C0 = CFrame.new(0, 0.05, 0.38) * CFrame.fromEulerAnglesXYZ(math.rad(20), 0, 0)
  405. w.C1 = CFrame.new()
  406. w.Parent = p
  407. local p = Instance.new("Part")
  408. p.Name = "Magazine"
  409. p.formFactor = "Symmetric"
  410. p.Size = Vector3.new(1, 1, 1)
  411. p.BrickColor = BrickColor.new("Sand green")
  412. p.Locked = true
  413. p.CanCollide = false
  414. p.TopSurface = 0
  415. p.BottomSurface = 0
  416. p.Parent = model
  417. local m = Instance.new("BlockMesh")
  418. m.Scale = Vector3.new(0.8, 0.43, 0.6)
  419. m.Parent = p
  420. local w = Instance.new("Weld")
  421. w.Part0 = p
  422. w.Part1 = pm
  423. w.C0 = CFrame.new(0, 0.46, -0.5)
  424. w.C1 = CFrame.new()
  425. w.Parent = p
  426. local p = Instance.new("Part")
  427. p.Name = "Magazine2"
  428. p.formFactor = "Symmetric"
  429. p.Size = Vector3.new(1, 1, 1)
  430. p.BrickColor = BrickColor.new("Bright yellow")
  431. p.Locked = true
  432. p.CanCollide = false
  433. p.Reflectance = 0.3
  434. if magazine.Value ~= 0 then
  435. p.Transparency = 0
  436. else
  437. p.Transparency = 1
  438. end
  439. p.TopSurface = 0
  440. p.BottomSurface = 0
  441. p.Parent = model
  442. local m = Instance.new("BlockMesh")
  443. m.Scale = Vector3.new(0.06, 0.36, 0.6)
  444. m.Parent = p
  445. local w = Instance.new("Weld")
  446. w.Part0 = p
  447. w.Part1 = pm
  448. w.C0 = CFrame.new(0.18, 0.46, -0.26) * CFrame.fromEulerAnglesXYZ(0, math.rad(20), 0)
  449. w.C1 = CFrame.new()
  450. w.Parent = p
  451. local p = Instance.new("Part")
  452. p.Name = "TriggerGuard"
  453. p.formFactor = "Symmetric"
  454. p.Size = Vector3.new(1, 1, 1)
  455. p.BrickColor = MC
  456. p.Reflectance = MR
  457. p.CanCollide = false
  458. p.Locked = true
  459. p.TopSurface = 0
  460. p.BottomSurface = 0
  461. p.Parent = model
  462. local m = Instance.new("SpecialMesh")
  463. m.MeshType = "FileMesh"
  464. m.MeshId = "http://www.roblox.com/asset/?id=3270017"
  465. m.Scale = Vector3.new(0.3, 0.3, 0.8)
  466. m.Parent = p
  467. local w = Instance.new("Weld")
  468. w.Part0 = p
  469. w.Part1 = pm
  470. w.C0 = CFrame.new(-0.25, 0, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  471. w.C1 = CFrame.new()
  472. w.Parent = p
  473. local p = Instance.new("Part")
  474. p.Name = "Trigger"
  475. p.formFactor = "Symmetric"
  476. p.Size = Vector3.new(1, 1, 1)
  477. p.BrickColor = BrickColor.new("Dark stone grey")
  478. p.Reflectance = MR
  479. p.CanCollide = false
  480. p.Locked = true
  481. p.TopSurface = 0
  482. p.BottomSurface = 0
  483. p.Parent = model
  484. local m = Instance.new("BlockMesh")
  485. m.Scale = Vector3.new(0.1, 0.4, 0.16)
  486. m.Parent = p
  487. local w = Instance.new("Weld")
  488. w.Part0 = p
  489. w.Part1 = pm
  490. w.C0 = CFrame.new(0, -0.14, -0.3)
  491. w.C1 = CFrame.new()
  492. w.Parent = p
  493. local p = Instance.new("Part")
  494. p.Name = "ForeBarrel"
  495. p.CanCollide = false
  496. p.formFactor = "Symmetric"
  497. p.Size = Vector3.new(1, 1, 1)
  498. p.BrickColor = GC
  499. p.Reflectance = GR
  500. p.Locked = true
  501. p.TopSurface = 0
  502. p.BottomSurface = 0
  503. p.Parent = model
  504. local m = Instance.new("BlockMesh")
  505. m.Scale = Vector3.new(0.25, 1, 0.25)
  506. m.Parent = p
  507. local w = Instance.new("Weld")
  508. w.Part0 = p
  509. w.Part1 = pm
  510. w.C0 = CFrame.new(0, 1.18, -0.1)
  511. w.C1 = CFrame.new()
  512. w.Parent = p
  513. local p = Instance.new("Part")
  514. p.Name = "ForeBarrel"
  515. p.CanCollide = false
  516. p.formFactor = "Symmetric"
  517. p.Size = Vector3.new(1, 1, 1)
  518. p.BrickColor = GC
  519. p.Reflectance = GR
  520. p.Locked = true
  521. p.TopSurface = 0
  522. p.BottomSurface = 0
  523. p.Parent = model
  524. local m = Instance.new("BlockMesh")
  525. m.Scale = Vector3.new(0.25, 0.8, 0.3)
  526. m.Parent = p
  527. local w = Instance.new("Weld")
  528. w.Part0 = p
  529. w.Part1 = pm
  530. w.C0 = CFrame.new(0, 1.09, -0.25)
  531. w.C1 = CFrame.new()
  532. w.Parent = p
  533. local p = Instance.new("Part")
  534. p.Name = "Shroud"
  535. p.CanCollide = false
  536. p.formFactor = "Symmetric"
  537. p.Size = Vector3.new(1, 1, 1)
  538. p.BrickColor = MC
  539. p.Reflectance = MR
  540. p.Locked = true
  541. p.TopSurface = 0
  542. p.BottomSurface = 0
  543. p.Parent = model
  544. local m = Instance.new("CylinderMesh")
  545. m.Scale = Vector3.new(0.26, 0.999, 0.26)
  546. m.Parent = p
  547. local w = Instance.new("Weld")
  548. w.Part0 = p
  549. w.Part1 = pm
  550. w.C0 = CFrame.new(0, 1.18, 0)
  551. w.C1 = CFrame.new()
  552. w.Parent = p
  553. local p = Instance.new("Part")
  554. p.Name = "Rail" --------------
  555. p.CanCollide = false
  556. p.formFactor = "Symmetric"
  557. p.Size = Vector3.new(1, 1, 1)
  558. p.BrickColor = MC
  559. p.Reflectance = MR
  560. p.Locked = true
  561. p.TopSurface = 0
  562. p.BottomSurface = 0
  563. p.Parent = model
  564. local m = Instance.new("BlockMesh")
  565. m.Scale = Vector3.new(0.18, 1, 0.18)
  566. m.Parent = p
  567. local w = Instance.new("Weld")
  568. w.Part0 = p
  569. w.Part1 = pm
  570. w.C0 = CFrame.new(0, 1.17, -0.04)
  571. w.C1 = CFrame.new()
  572. w.Parent = p
  573. local p = Instance.new("Part")
  574. p.Name = "Barrel 1"
  575. p.formFactor = "Symmetric"
  576. p.Size = Vector3.new(1, 1, 1)
  577. p.BrickColor = DC
  578. p.Reflectance = MR
  579. p.CanCollide = false
  580. p.Locked = true
  581. p.TopSurface = 0
  582. p.BottomSurface = 0
  583. p.Parent = model
  584. local m = Instance.new("CylinderMesh")
  585. m.Scale = Vector3.new(0.15, 0.8, 0.15)
  586. m.Parent = p
  587. local w = Instance.new("Weld")
  588. w.Part0 = p
  589. w.Part1 = pm
  590. w.C0 = CFrame.new(0, 1.6, -0.04)
  591. w.C1 = CFrame.new()
  592. w.Parent = p
  593. local p = Instance.new("Part")
  594. p.Name = "Hole"
  595. p.formFactor = "Symmetric"
  596. p.Size = Vector3.new(1, 1, 1)
  597. p.BrickColor = BrickColor.new("Really black")
  598. p.CanCollide = false
  599. p.Locked = true
  600. p.TopSurface = 0
  601. p.BottomSurface = 0
  602. p.Parent = model
  603. local m = Instance.new("CylinderMesh")
  604. m.Scale = Vector3.new(0.14, 0.4, 0.14)
  605. m.Offset = Vector3.new(0, 0.2, 0)
  606. m.Parent = p
  607. local w = Instance.new("Weld")
  608. w.Part0 = p
  609. w.Part1 = pm
  610. w.C0 = CFrame.new(0, 2.405, -0.04)
  611. w.C1 = CFrame.new()
  612. w.Parent = p
  613. local p = Instance.new("Part")
  614. if silenced == false then
  615. p.Name = "Muzzle"
  616. else
  617. p.Name = "Muzzle 2"
  618. end
  619. p.formFactor = "Symmetric"
  620. p.Size = Vector3.new(1, 1, 1)
  621. p.BrickColor = DC
  622. p.Reflectance = MR
  623. p.CanCollide = false
  624. p.Locked = true
  625. p.TopSurface = 0
  626. p.BottomSurface = 0
  627. p.Parent = model
  628. local m = Instance.new("CylinderMesh")
  629. m.Scale = Vector3.new(0.18, 0.4, 0.18)
  630. m.Offset = Vector3.new(0, 0.2, 0)
  631. m.Parent = p
  632. local w = Instance.new("Weld")
  633. w.Part0 = p
  634. w.Part1 = pm
  635. w.C0 = CFrame.new(0, 2.4, -0.04)
  636. w.C1 = CFrame.new()
  637. w.Parent = p
  638. local s = Instance.new("Smoke")
  639. s.Enabled = false
  640. s.Name = "Smoke"
  641. s.RiseVelocity = -5
  642. s.Opacity = 0.3
  643. s.Color = Color3.new(75 / 225, 75 / 225, 75 / 225)
  644. s.Size = 1
  645. s.Parent = p
  646. local f = Instance.new("Fire")
  647. f.Enabled = false
  648. f.Name = "Fire"
  649. f.Heat = -35
  650. f.Size = 1
  651. f.Parent = p
  652. local p = Instance.new("Part")
  653. p.Name = "Silencer"
  654. p.formFactor = "Symmetric"
  655. p.Size = Vector3.new(1, 1, 1)
  656. p.BrickColor = BrickColor.new("Black")
  657. p.CanCollide = false
  658. if silenced == false then
  659. p.Name = "Silencer"
  660. p.Transparency = 1
  661. else
  662. p.Name = "Muzzle"
  663. p.Transparency = 0
  664. end
  665. p.Locked = true
  666. p.TopSurface = 0
  667. p.BottomSurface = 0
  668. p.Parent = model
  669. local m = Instance.new("CylinderMesh")
  670. m.Scale = Vector3.new(0.25, 0.8, 0.25)
  671. m.Parent = p
  672. local w = Instance.new("Weld")
  673. w.Part0 = p
  674. w.Part1 = pm
  675. w.C0 = CFrame.new(0, 2.5, -0.04)
  676. w.C1 = CFrame.new()
  677. w.Parent = p
  678. if Holstered == true then
  679. local p = Instance.new("Part")
  680. p.Name = "StockI"
  681. p.CanCollide = false
  682. p.formFactor = "Symmetric"
  683. p.Size = Vector3.new(1, 1, 1)
  684. p.BrickColor = MC
  685. p.Reflectance = MR
  686. p.Locked = true
  687. p.TopSurface = 0
  688. p.BottomSurface = 0
  689. p.Parent = model
  690. local m = Instance.new("CylinderMesh")
  691. m.Scale = Vector3.new(0.36, 0.2, 0.36)
  692. m.Parent = p
  693. local w = Instance.new("Weld")
  694. w.Part0 = p
  695. w.Part1 = pm
  696. w.C0 = CFrame.new(0, -0.7, -0.1)
  697. w.C1 = CFrame.new()
  698. w.Parent = p
  699. else
  700. local p = Instance.new("Part")
  701. p.Name = "StockO"
  702. p.CanCollide = false
  703. p.formFactor = "Symmetric"
  704. p.Size = Vector3.new(1, 1, 1)
  705. p.BrickColor = MC
  706. p.Reflectance = MR
  707. p.Locked = true
  708. p.TopSurface = 0
  709. p.BottomSurface = 0
  710. p.Parent = model
  711. local m = Instance.new("CylinderMesh")
  712. m.Scale = Vector3.new(0.36, 0.2, 0.36)
  713. m.Parent = p
  714. local w = Instance.new("Weld")
  715. w.Part0 = p
  716. w.Part1 = pm
  717. w.C0 = CFrame.new(0, -1.4, -0.1)
  718. w.C1 = CFrame.new()
  719. w.Parent = p
  720. local p = Instance.new("Part")
  721. p.Name = "StockArm"
  722. p.CanCollide = false
  723. p.formFactor = "Symmetric"
  724. p.Size = Vector3.new(1, 1, 1)
  725. p.BrickColor = MC
  726. p.Reflectance = MR
  727. p.Locked = true
  728. p.TopSurface = 0
  729. p.BottomSurface = 0
  730. p.Parent = model
  731. local m = Instance.new("BlockMesh")
  732. m.Scale = Vector3.new(0.1, 0.8, 0.1)
  733. m.Offset = Vector3.new(0, 0, 0.12)
  734. m.Parent = p
  735. local w = Instance.new("Weld")
  736. w.Part0 = p
  737. w.Part1 = pm
  738. w.C0 = CFrame.new(0, -0.9, -0.1)
  739. w.C1 = CFrame.new()
  740. w.Parent = p
  741. local p = Instance.new("Part")
  742. p.Name = "StockArm"
  743. p.CanCollide = false
  744. p.formFactor = "Symmetric"
  745. p.Size = Vector3.new(1, 1, 1)
  746. p.BrickColor = MC
  747. p.Reflectance = MR
  748. p.Locked = true
  749. p.TopSurface = 0
  750. p.BottomSurface = 0
  751. p.Parent = model
  752. local m = Instance.new("BlockMesh")
  753. m.Scale = Vector3.new(0.1, 0.8, 0.1)
  754. m.Offset = Vector3.new(0, 0, -0.12)
  755. m.Parent = p
  756. local w = Instance.new("Weld")
  757. w.Part0 = p
  758. w.Part1 = pm
  759. w.C0 = CFrame.new(0, -0.9, -0.1)
  760. w.C1 = CFrame.new()
  761. w.Parent = p
  762. end
  763. return model
  764. end
  765.  
  766.  
  767. function removeParts(format)
  768. if format == "RightHand" then
  769. pcall(function() Player.Character[Name]:Remove() end)
  770. elseif format == "LeftHand" then
  771. pcall(function() Player.Character[Name.. " (Left)"]:Remove() end)
  772. elseif format == "RightHolster" then
  773. pcall(function() Player.Character[Name.. " (Holstered)"]:Remove() end)
  774. elseif format == "LeftHolster" then
  775. pcall(function() Player.Character[Name.. " (Holstered, Left)"]:Remove() end)
  776. end
  777. end
  778.  
  779.  
  780. function SetAngle(Joint, Angle, Character)
  781. if Character == nil then return false end
  782. local Joints = {
  783. Character.Torso:FindFirstChild("Right Shoulder 2"),
  784. Character.Torso:FindFirstChild("Left Shoulder 2"),
  785. Character.Torso:FindFirstChild("Right Hip 2"),
  786. Character.Torso:FindFirstChild("Left Hip 2")
  787. }
  788. if Joints[Joint] == nil then return false end
  789. if Joint == 1 or Joint == 3 then
  790. Joints[Joint].DesiredAngle = Angle
  791. end
  792. if Joint == 2 or Joint == 4 then
  793. Joints[Joint].DesiredAngle = -Angle
  794. end
  795. end
  796.  
  797.  
  798. function ForceAngle(Joint, Angle, Character)
  799. if Character == nil then return false end
  800. local Joints = {
  801. Character.Torso:FindFirstChild("Right Shoulder 2"),
  802. Character.Torso:FindFirstChild("Left Shoulder 2"),
  803. Character.Torso:FindFirstChild("Right Hip 2"),
  804. Character.Torso:FindFirstChild("Left Hip 2")
  805. }
  806. if Joints[Joint] == nil then return false end
  807. if Joint == 1 or Joint == 3 then
  808. Joints[Joint].DesiredAngle = Angle
  809. Joints[Joint].CurrentAngle = Angle
  810. end
  811. if Joint == 2 or Joint == 4 then
  812. Joints[Joint].DesiredAngle = -Angle
  813. Joints[Joint].CurrentAngle = -Angle
  814. end
  815. end
  816.  
  817.  
  818. function SetSpeed(Joint, Speed, Character)
  819. if Character == nil then return false end
  820. local Joints = {
  821. Character.Torso:FindFirstChild("Right Shoulder 2"),
  822. Character.Torso:FindFirstChild("Left Shoulder 2"),
  823. Character.Torso:FindFirstChild("Right Hip 2"),
  824. Character.Torso:FindFirstChild("Left Hip 2")
  825. }
  826. if Joints[Joint] == nil then return false end
  827. Joints[Joint].MaxVelocity = Speed
  828. end
  829.  
  830.  
  831. function DisableLimb(Limb, Character)
  832. if Character == nil then return false end
  833. if Character:FindFirstChild("Torso") == nil then return false end
  834. local Joints = {
  835. Character.Torso:FindFirstChild("Right Shoulder"),
  836. Character.Torso:FindFirstChild("Left Shoulder"),
  837. Character.Torso:FindFirstChild("Right Hip"),
  838. Character.Torso:FindFirstChild("Left Hip")
  839. }
  840. local Limbs = {
  841. Character:FindFirstChild("Right Arm"),
  842. Character:FindFirstChild("Left Arm"),
  843. Character:FindFirstChild("Right Leg"),
  844. Character:FindFirstChild("Left Leg")
  845. }
  846. if Joints[Limb] == nil then return false end
  847. if Limbs[Limb] == nil then return false end
  848. local Joint = Instance.new("Motor")
  849. Joint.Parent = Character.Torso
  850. Joint.Part0 = Character.Torso
  851. Joint.Part1 = Limbs[Limb]
  852. if Limb == 1 then
  853. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  854. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  855. Joint.Name = "Right Shoulder 2"
  856. elseif Limb == 2 then
  857. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  858. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  859. Joint.Name = "Left Shoulder 2"
  860. elseif Limb == 3 then
  861. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  862. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  863. Joint.Name = "Right Hip 2"
  864. elseif Limb == 4 then
  865. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  866. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  867. Joint.Name = "Left Hip 2"
  868. end
  869. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  870. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  871. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  872. Joints[Limb]:Remove()
  873. end
  874.  
  875.  
  876. function ResetLimbCFrame(Limb, Character)
  877. if Character == nil then return false end
  878. if Character.Parent == nil then return false end
  879. if Character:FindFirstChild("Torso") == nil then return false end
  880. local Joints = {
  881. Character.Torso:FindFirstChild("Right Shoulder 2"),
  882. Character.Torso:FindFirstChild("Left Shoulder 2"),
  883. Character.Torso:FindFirstChild("Right Hip 2"),
  884. Character.Torso:FindFirstChild("Left Hip 2")
  885. }
  886. local Limbs = {
  887. Character:FindFirstChild("Right Arm"),
  888. Character:FindFirstChild("Left Arm"),
  889. Character:FindFirstChild("Right Leg"),
  890. Character:FindFirstChild("Left Leg")
  891. }
  892. if Joints[Limb] == nil then return false end
  893. if Limbs[Limb] == nil then return false end
  894. if Limb == 1 then
  895. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  896. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  897. elseif Limb == 2 then
  898. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  899. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  900. elseif Limb == 3 then
  901. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  902. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  903. elseif Limb == 4 then
  904. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  905. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  906. end
  907. end
  908.  
  909.  
  910. function EnableLimb(Limb, Character)
  911. if Character == nil then return false end
  912. if Character:FindFirstChild("Torso") == nil then return false end
  913. local Joints = {
  914. Character.Torso:FindFirstChild("Right Shoulder 2"),
  915. Character.Torso:FindFirstChild("Left Shoulder 2"),
  916. Character.Torso:FindFirstChild("Right Hip 2"),
  917. Character.Torso:FindFirstChild("Left Hip 2")
  918. }
  919. local Limbs = {
  920. Character:FindFirstChild("Right Arm"),
  921. Character:FindFirstChild("Left Arm"),
  922. Character:FindFirstChild("Right Leg"),
  923. Character:FindFirstChild("Left Leg")
  924. }
  925. if Joints[Limb] == nil then return false end
  926. if Limbs[Limb] == nil then return false end
  927. if Limb == 1 then
  928. Joints[Limb].Name = "Right Shoulder"
  929. elseif Limb == 2 then
  930. Joints[Limb].Name = "Left Shoulder"
  931. elseif Limb == 3 then
  932. Joints[Limb].Name = "Right Hip"
  933. elseif Limb == 4 then
  934. Joints[Limb].Name = "Left Hip"
  935. end
  936. Animate = Character:FindFirstChild("Animate")
  937. if Animate == nil then return false end
  938. Animate = Animate:Clone()
  939. Character.Animate:Remove()
  940. Animate.Parent = Character
  941. end
  942.  
  943.  
  944. function playAnimation(format, mouse)
  945. if format == "equip" then
  946. Player.Character.Humanoid.WalkSpeed = WSPenalty
  947. coroutine.resume(coroutine.create(function()
  948. for i = 0, 1, 0.025 do
  949. if Player.Character:FindFirstChild("Torso") ~= nil then
  950. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  951. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i)
  952. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
  953. else return false end
  954. else return false end
  955. wait()
  956. end
  957. end))
  958. for i = 0, 1, 0.05 do
  959. if Player.Character:FindFirstChild("Torso") ~= nil then
  960. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  961. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i)
  962. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
  963. else return false end
  964. else return false end
  965. wait()
  966. end
  967. removeParts("RightHolster")
  968. makeParts("RightHand")
  969. for i = 0, 1, 0.05 do
  970. if Player.Character:FindFirstChild("Torso") ~= nil then
  971. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  972. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0)
  973. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
  974. else return false end
  975. else return false end
  976. if Player.Character:FindFirstChild(Name) ~= nil then
  977. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  978. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
  979. Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
  980. else return false end
  981. else return false end
  982. wait()
  983. end
  984. makeParts("RightHolster")
  985. removeParts("RightHand")
  986. return playAnimation("hold")
  987. end
  988. if format == "unequip" then
  989. Player.Character.Humanoid.WalkSpeed = 16
  990. coroutine.resume(coroutine.create(function()
  991. for i = 1, 0, -0.025 do
  992. if Player.Character:FindFirstChild("Torso") ~= nil then
  993. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  994. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, math.rad(67.5) * i)
  995. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 1.85 * i, 0)
  996. else return false end
  997. else return false end
  998. wait()
  999. end
  1000. end))
  1001. for i = 1, 0, -0.05 do
  1002. if Player.Character:FindFirstChild("Torso") ~= nil then
  1003. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1004. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5 * (1 - i), 0.5 * (1 - i), -0.25 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, math.rad(-20) * (1 - i)) * CFrame.new(1.25 * i, 0.5 * i, 0) * CFrame.fromEulerAnglesXYZ(math.rad(90) * i, 0, 0)
  1005. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5 * (1 - i), 0) * CFrame.new(0, 0.75 * i, 0.1 * i)
  1006. else return false end
  1007. else return false end
  1008. if Player.Character:FindFirstChild(Name) ~= nil then
  1009. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1010. Player.Character[Name].Handle.Weld.C0 = CFrame.new(0, 1.5, 0.75)
  1011. Player.Character[Name].Handle.Weld.C1 = CFrame.fromEulerAnglesXYZ(math.rad(-90) * (1 - i), 0, 0)
  1012. else return false end
  1013. else return false end
  1014. wait()
  1015. end
  1016. makeParts("RightHolster")
  1017. removeParts("RightHand")
  1018. for i = 1, 0, -0.05 do
  1019. if Player.Character:FindFirstChild("Torso") ~= nil then
  1020. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1021. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new(1.5, 0.5, -0.25 * i) * CFrame.fromEulerAnglesXYZ(math.rad(-90) * i, 0, math.rad(-20) * i)
  1022. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(0, 0.5, 0)
  1023. else return false end
  1024. else return false end
  1025. wait()
  1026. end
  1027. removeParts("RightHolster")
  1028. makeParts("RightHand")
  1029. return true
  1030. end
  1031. if format == "hold" then
  1032. if Player.Character:FindFirstChild("Torso") ~= nil then
  1033. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1034. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1035. 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))
  1036. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1037. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1038. else return false end
  1039. else return false end
  1040. end
  1041. if format == "reload" then
  1042. Player.Character[Name].Handle.Weld:Remove()
  1043. local w = Instance.new("Weld")
  1044. w.Part0 = Player.Character[Name].Handle
  1045. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  1046. w.C0 = CFrame.new(-0.85, -0.5, 0.5) * CFrame.fromEulerAnglesXYZ(math.rad(-5), math.rad(90), 0)
  1047. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, 0)
  1048. w.Parent = Player.Character[Name].Handle
  1049. if Player.Character:FindFirstChild("Torso") ~= nil then
  1050. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1051. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1052. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 1.2, 0.8) * CFrame.fromEulerAnglesXYZ(math.rad(300), math.rad(10), math.rad(-90))
  1053. else return false end
  1054. else return false end
  1055. wait(0.3)
  1056. for i = 0, 1, 0.1 do
  1057. if Player.Character:FindFirstChild("Torso") ~= nil then
  1058. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1059. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1060. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1061. wait()
  1062. else return false end
  1063. else return false end
  1064. end
  1065. for i = 0, 1, 0.25 do
  1066. if Player.Character:FindFirstChild("Torso") ~= nil then
  1067. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1068. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1069. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1070. wait()
  1071. else return false end
  1072. else return false end
  1073. end
  1074. Player.Character[Name].Handle.Equip:Play()
  1075. if magazine.Value ~= 0 then
  1076. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  1077. else end
  1078. for i = 1, 0, -0.25 do
  1079. if Player.Character:FindFirstChild("Torso") ~= nil then
  1080. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1081. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1082. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.8, 1.15 - (i / 5), 0.635) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1083. wait()
  1084. else return false end
  1085. else return false end
  1086. end
  1087. for i = 1, 0, -0.1 do
  1088. if Player.Character:FindFirstChild("Torso") ~= nil then
  1089. if Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1090. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1091. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9 + (i / 10), -0.35 + (i * 1.5), 0.51 + (i / 8)) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1092. wait()
  1093. else return false end
  1094. else return false end
  1095. end
  1096. removeParts("RightHand")
  1097. makeParts("RightHand")
  1098. wait(0.4)
  1099. Player.Character[Name].Handle.Lock:Play()
  1100. for i = 5, 0, -1 do
  1101. if Player.Character:FindFirstChild("Torso") ~= nil then
  1102. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1103. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1104. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1105. wait()
  1106. else return false end
  1107. else return false end
  1108. end
  1109. Player.Character[Name].TopC.Transparency = 1
  1110. Player.Character[Name].TopO.Transparency = 0
  1111. Player.Character[Name].Top2C.Transparency = 1
  1112. Player.Character[Name].Top2O.Transparency = 0
  1113. wait(0.4)
  1114. Player.Character[Name].Handle.Reload:Play()
  1115. Player.Character[Name].Handle.Release:Play()
  1116. Player.Character[Name].Magazine.Transparency = 1
  1117. Player.Character[Name].Magazine2.Transparency = 1
  1118. magazineDrop = Player.Character[Name].Magazine:Clone()
  1119. magazineDrop.Transparency = 0
  1120. magazineDrop.CanCollide = true
  1121. magazineDrop.Parent = game.Workspace
  1122. coroutine.resume(coroutine.create(function(part) wait(4.5) for i = 0, 1, 0.1 do part.Transparency = i wait() end part:Remove() end), magazineDrop)
  1123. delay(0.1, function() magazineDrop.CanCollide = true end)
  1124. for i = 0, 25, 5 do
  1125. if Player.Character:FindFirstChild("Torso") ~= nil then
  1126. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1127. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1128. 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))
  1129. wait()
  1130. else return false end
  1131. else return false end
  1132. end
  1133. magazineNew = Player.Character[Name].Magazine:Clone()
  1134. magazineNew.Name = "New Magazine"
  1135. magazineNew.Transparency = 0
  1136. magazineNew.Parent = Player.Character[Name]
  1137. local w = Instance.new("Weld")
  1138. w.Part0 = magazineNew
  1139. w.Part1 = Player.Character:FindFirstChild("Left Arm")
  1140. w.C0 = CFrame.new(0, 1.1, 0)
  1141. w.C1 = CFrame.new() * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  1142. w.Parent = magazineNew
  1143. wait(0.2)
  1144. for i = 25, 0, -5 do
  1145. if Player.Character:FindFirstChild("Torso") ~= nil then
  1146. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1147. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1148. 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))
  1149. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1150. 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)))
  1151. wait()
  1152. else return false end
  1153. else return false end
  1154. end
  1155. Player.Character[Name].Magazine.Transparency = 0
  1156. Player.Character[Name]["New Magazine"]:Remove()
  1157. wait(0.1)
  1158. if Player.Character:FindFirstChild("Torso") ~= nil then
  1159. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1160. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1161. 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))
  1162. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1163. Player.Character.Torso["Right Shoulder 2"].C1 = CFrame.new(-0.9, -0.35, 0.51) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), 0)
  1164. else return false end
  1165. else return false end
  1166. Player.Character[Name].Handle.Reload:Stop()
  1167. wait(0.4)
  1168. Player.Character[Name].Handle.Empty:Play()
  1169. for i = 5, 0, -1 do
  1170. if Player.Character:FindFirstChild("Torso") ~= nil then
  1171. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1172. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1173. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1174. wait()
  1175. else return false end
  1176. else return false end
  1177. end
  1178. Player.Character[Name].Magazine2.Transparency = 0
  1179. wait(0.4)
  1180. Player.Character[Name].Handle.Lock:Play()
  1181. for i = 5, 0, -1 do
  1182. if Player.Character:FindFirstChild("Torso") ~= nil then
  1183. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1184. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1185. Player.Character.Torso["Left Shoulder 2"].C1 = CFrame.new(-0.55, 0.75, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(315 + (i * 1.5)), math.rad(i * 4), math.rad(-90))
  1186. wait()
  1187. else return false end
  1188. else return false end
  1189. end
  1190. Player.Character[Name].TopC.Transparency = 0
  1191. Player.Character[Name].TopO.Transparency = 1
  1192. Player.Character[Name].Top2C.Transparency = 0
  1193. Player.Character[Name].Top2O.Transparency = 1
  1194. playAnimation("hold")
  1195. return true
  1196. end
  1197. if format == "fire" then
  1198. makeShell(Player.Character[Name]:FindFirstChild("ShellOut"))
  1199. if magazine.Value == 0 then
  1200. Player.Character[Name].Magazine2.Transparency = 1
  1201. else end
  1202. if Player.Character[Name]:FindFirstChild("Handle") ~= nil then
  1203. if silenced then
  1204. Player.Character[Name].Handle.Fire2.Volume = math.random(3, 8) / 10
  1205. Player.Character[Name].Handle.Fire2.Pitch = math.random(2.4, 3)
  1206. Player.Character[Name].Handle.Fire2:Play()
  1207. CamShake(10, 90000)
  1208. else
  1209. Player.Character[Name].Handle.Fire.Volume = math.random(9, 10) / 10
  1210. Player.Character[Name].Handle.Fire.Pitch = math.random(1.6, 1.8)
  1211. Player.Character[Name].Handle.Fire:Play()
  1212. CamShake(10, 80000)
  1213. end
  1214. else return false end
  1215. if Player.Character[Name]:FindFirstChild("Muzzle") ~= nil then
  1216. if silenced == false then
  1217. 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))
  1218. else end
  1219. else return false end
  1220. for i = 0, 10, 5 do
  1221. if Player.Character:FindFirstChild("Torso") ~= nil then
  1222. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1223. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1224. 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))
  1225. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1226. 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)
  1227. wait()
  1228. else return false end
  1229. else return false end
  1230. end
  1231. for i = 10, 0, -5 do
  1232. if Player.Character:FindFirstChild("Torso") ~= nil then
  1233. if Player.Character.Torso:FindFirstChild("Left Shoulder 2") ~= nil and Player.Character.Torso:FindFirstChild("Right Shoulder 2") ~= nil then
  1234. Player.Character.Torso["Left Shoulder 2"].C0 = CFrame.new()
  1235. 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))
  1236. Player.Character.Torso["Right Shoulder 2"].C0 = CFrame.new()
  1237. 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)
  1238. wait()
  1239. else return false end
  1240. else return false end
  1241. end
  1242. end
  1243. return true
  1244. end
  1245.  
  1246.  
  1247. function CamShake(time, freq)
  1248. coroutine.resume(coroutine.create(function()
  1249. local cam = game:GetService("Workspace").CurrentCamera
  1250. local time = 10
  1251. local seed = Vector3.new(math.random(100, 200) / freq, math.random(100, 200) / freq, 0)
  1252. if math.random(1, 2) == 1 then seed = Vector3.new(-seed.x, seed.y, 0) end
  1253. if math.random(1, 2) == 1 then seed = Vector3.new(seed.x, -seed.y, 0) end
  1254. 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)
  1255. for i = 1, time do
  1256. 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)
  1257. wait()
  1258. end
  1259. end))
  1260. end
  1261.  
  1262.  
  1263. function makeShell(part)
  1264. if part == nil then return false end
  1265. local casing = Instance.new("Part")
  1266. casing.Name = "Shell"
  1267. casing.formFactor = "Custom"
  1268. casing.Size = Vector3.new(0.2, 0.25, 0.2)
  1269. 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)))
  1270. casing.BrickColor = BrickColor.new("New Yeller")
  1271. local mesh = Instance.new("CylinderMesh")
  1272. mesh.Scale = Vector3.new(0.3, 1, 0.3)
  1273. mesh.Parent = casing
  1274. casing.Parent = game:GetService("Workspace")
  1275. casing:BreakJoints()
  1276. casing.Velocity = (part.CFrame.lookVector * 50) + Vector3.new(0, 10, 0)
  1277. coroutine.resume(coroutine.create(function() wait(4.5) for i = 0, 1, 0.1 do casing.Transparency = i wait() end casing:Remove() end))
  1278. end
  1279.  
  1280.  
  1281. function Weld(x, y)
  1282. local weld = Instance.new("Weld")
  1283. weld.Part0 = x
  1284. weld.Part1 = y
  1285. CJ = CFrame.new(x.Position)
  1286. C0 = x.CFrame:inverse() * CJ
  1287. C1 = y.CFrame:inverse() * CJ
  1288. weld.C0 = C0
  1289. weld.C1 = C1
  1290. weld.Parent = x
  1291. end
  1292.  
  1293.  
  1294. function tagHumanoid(humanoid)
  1295. local tag = Instance.new("ObjectValue")
  1296. tag.Name = "creator"
  1297. tag.Value = Player
  1298. tag.Parent = humanoid
  1299. local tag = Instance.new("StringValue")
  1300. tag.Name = "creatorType1"
  1301. tag.Value = Name
  1302. tag.Parent = humanoid
  1303. local tag = Instance.new("StringValue")
  1304. tag.Name = "creatorType2"
  1305. tag.Value = "shot"
  1306. tag.Parent = humanoid
  1307. end
  1308.  
  1309.  
  1310. function untagHumanoid(humanoid)
  1311. if humanoid ~= nil then
  1312. local tag = humanoid:FindFirstChild("creator")
  1313. if tag ~= nil then
  1314. tag:Remove()
  1315. end
  1316. local tag = humanoid:FindFirstChild("creatorType1")
  1317. if tag ~= nil then
  1318. tag:Remove()
  1319. end
  1320. local tag = humanoid:FindFirstChild("creatorType2")
  1321. if tag ~= nil then
  1322. tag:Remove()
  1323. end
  1324. end
  1325. end
  1326.  
  1327.  
  1328. function fire(startPoint, endPoint, hit)
  1329. local trail = Instance.new("Part")
  1330. trail.Name = "Bullet Trail"
  1331. trail.BrickColor = BrickColor.new("New Yeller")
  1332. trail.TopSurface = 0
  1333. trail.BottomSurface = 0
  1334. trail.formFactor = 0
  1335. trail.Size = Vector3.new(1, 1, 1)
  1336. trail.Transparency = 0.8
  1337. trail.Anchored = true
  1338. trail.CanCollide = false
  1339. trail.CFrame = CFrame.new((startPoint + endPoint) / 2, endPoint)
  1340. trail.Parent = game:GetService("Workspace")
  1341. local mesh = Instance.new("SpecialMesh")
  1342. mesh.MeshType = "Brick"
  1343. mesh.Scale = Vector3.new(0.1, 0.1, (startPoint - endPoint).magnitude)
  1344. mesh.Parent = trail
  1345. 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)
  1346. if hit ~= nil then
  1347. if hit.Parent == nil then return end
  1348. if hit.Parent:FindFirstChild("Humanoid") ~= nil then
  1349. tagHumanoid(hit.Parent.Humanoid)
  1350. if hit.Name == "Head" then
  1351. hit.Parent.Humanoid:TakeDamage(damage * 10)
  1352. elseif hit.Name == "Torso" then
  1353. hit.Parent.Humanoid:TakeDamage(damage * 2)
  1354. else
  1355. hit.Parent.Humanoid:TakeDamage(damage)
  1356. end
  1357. if math.random(1, 10) == 1 then
  1358. hit.Parent.Humanoid.Sit = true
  1359. end
  1360. delay(0.1, function() untagHumanoid(hit.Parent.Humanoid) end)
  1361. end
  1362. if hit.Anchored == false then
  1363. hit.Velocity = hit.Velocity + ((endPoint - startPoint).unit * (damage * 2))
  1364. end
  1365. end
  1366. end
  1367.  
  1368.  
  1369. function onButton1Down(mouse)
  1370. if selected == false then return end
  1371. 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
  1372. if Player.Character[Name]:FindFirstChild("Handle") == nil then return end
  1373. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1374. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end end
  1375. if dual == true then if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end end
  1376. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1377. Button1Down = true
  1378. canFire = false
  1379. canFire2 = true
  1380. while canFire2 == true do
  1381. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1382. if humanoid == nil then
  1383. canFire2 = false
  1384. break
  1385. end
  1386. if humanoid.Health <= 0 then
  1387. canFire2 = false
  1388. break
  1389. end
  1390. local fireLeft = false
  1391. if automatic == false and burst == false then
  1392. canFire2 = false
  1393. elseif automatic == false and burst == true then
  1394. if burstCount >= burstCountMax then
  1395. canFire2 = false
  1396. burstCount = 0
  1397. break
  1398. end
  1399. burstCount = burstCount + 1
  1400. elseif automatic == true and burst == false then
  1401. fireLeft = true
  1402. end
  1403. if magazine.Value > 0 then
  1404. magazine.Value = magazine.Value - 1
  1405. updateGui()
  1406. if silenced == true then
  1407. CamShake(1, Spread)
  1408. else end
  1409. fire(Player.Character[Name].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1410. coroutine.resume(coroutine.create(function()
  1411. if dual == true then
  1412. playAnimation("rightFire")
  1413. elseif dual == false then
  1414. playAnimation("fire")
  1415. end
  1416. end))
  1417. else
  1418. Player.Character[Name].Handle.Empty:Play()
  1419. end
  1420. if fireLeft == true and dual == true and automatic == true then
  1421. if magazine.Value > 0 then
  1422. coroutine.resume(coroutine.create(function()
  1423. wait(readyTime / 2)
  1424. magazine.Value = magazine.Value - 1
  1425. updateGui()
  1426. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1427. playAnimation("leftFire")
  1428. end))
  1429. else
  1430. coroutine.resume(coroutine.create(function()
  1431. wait(readyTime / 2)
  1432. Player.Character[Name].Handle.Empty:Play()
  1433. end))
  1434. end
  1435. end
  1436. wait(readyTime)
  1437. end
  1438. if magazine.Value ~= 0 then
  1439. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1440. else end
  1441. canFire = true
  1442. end
  1443. end
  1444.  
  1445.  
  1446. function onButton1Up(mouse)
  1447. if selected == false then return end
  1448. Button1Down = false
  1449. canFire2 = false
  1450. burstCount = 0
  1451. while canFire == false do wait() end
  1452. if dual == true and automatic == false then
  1453. if Player.Character[Name.. " (Left)"]:FindFirstChild("Handle") == nil then return end
  1454. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1455. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1456. canFire = false
  1457. canFire2 = true
  1458. while canFire2 == true do
  1459. local humanoid = Player.Character:FindFirstChild("Humanoid")
  1460. if humanoid == nil then
  1461. canFire2 = false
  1462. break
  1463. end
  1464. if humanoid.Health <= 0 then
  1465. canFire2 = false
  1466. break
  1467. end
  1468. if burst == false then
  1469. canFire2 = false
  1470. elseif burst == true then
  1471. if burstCount >= burstCountMax then
  1472. canFire2 = false
  1473. burstCount = 0
  1474. break
  1475. end
  1476. burstCount = burstCount + 1
  1477. end
  1478. if magazine.Value <= 0 then
  1479. Player.Character[Name].Handle.Empty:Play()
  1480. else
  1481. coroutine.resume(coroutine.create(function()
  1482. playAnimation("leftFire")
  1483. end))
  1484. magazine.Value = magazine.Value - 1
  1485. updateGui()
  1486. fire(Player.Character[Name.. " (Left)"].Muzzle.Position, mouse.Hit.p, mouse.Target)
  1487. end
  1488. wait(readyTime)
  1489. end
  1490. if magazine.Value ~= 0 then
  1491. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1492. else end
  1493. canFire = true
  1494. end
  1495. end
  1496.  
  1497.  
  1498. function onKeyDown(key, mouse)
  1499. if selected == false then return end
  1500. key = key:lower()
  1501. if key == "q" and Button1Down == false and canFire == true then
  1502. if mouse.Target == nil then return end
  1503. if game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent) ~= nil then
  1504. if dual == true then onKeyDown("t", mouse) end
  1505. onDeselected(mouse)
  1506. removeParts("RightHolster")
  1507. script.Parent.Parent = game:GetService("Players"):GetPlayerFromCharacter(mouse.Target.Parent).Backpack
  1508. end
  1509. end
  1510. if key == "e" and Button1Down == false and canFire == true and canSilence == true then
  1511. if silenced then
  1512. silenced = false
  1513. if Player.Character:FindFirstChild(Name) == nil then return end
  1514. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1515. if Player.Character[Name]:FindFirstChild("Muzzle 2") == nil then return end
  1516. Player.Character[Name].Muzzle.Transparency = 1
  1517. Player.Character[Name].Muzzle.Name = "Silencer"
  1518. Player.Character[Name]["Muzzle 2"].Name = "Muzzle"
  1519. if dual == true then
  1520. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1521. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle 2") == nil then return end
  1522. Player.Character[Name.. " (Left)"].Muzzle.Transparency = 1
  1523. Player.Character[Name.. " (Left)"].Muzzle.Name = "Silencer"
  1524. Player.Character[Name.. " (Left)"]["Muzzle 2"].Name = "Muzzle"
  1525. end
  1526. else
  1527. silenced = true
  1528. if Player.Character:FindFirstChild(Name) == nil then return end
  1529. if Player.Character[Name]:FindFirstChild("Silencer") == nil then return end
  1530. if Player.Character[Name]:FindFirstChild("Muzzle") == nil then return end
  1531. Player.Character[Name].Silencer.Transparency = 0
  1532. Player.Character[Name].Muzzle.Name = "Muzzle 2"
  1533. Player.Character[Name].Silencer.Name = "Muzzle"
  1534. if dual == true then
  1535. if Player.Character[Name.. " (Left)"]:FindFirstChild("Silencer") == nil then return end
  1536. if Player.Character[Name.. " (Left)"]:FindFirstChild("Muzzle") == nil then return end
  1537. Player.Character[Name.. " (Left)"].Silencer.Transparency = 0
  1538. Player.Character[Name.. " (Left)"].Muzzle.Name = "Muzzle 2"
  1539. Player.Character[Name.. " (Left)"].Silencer.Name = "Muzzle"
  1540. end
  1541. end
  1542. end
  1543. if key == "r" and Button1Down == false and canFire == true then
  1544. if ammo.Value > 0 and magazine.Value ~= magazineMax.Value then
  1545. canFire = false
  1546. burstCount = 0
  1547. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1548. if magazine.Value > 0 then ammo.Value = ammo.Value + magazine.Value magazine.Value = 0 end
  1549. updateGui()
  1550. if dual == true then
  1551. playAnimation("reloadDual")
  1552. elseif dual == false then
  1553. playAnimation("reload")
  1554. end
  1555. if ammo.Value - magazineMax.Value < 0 then
  1556. magazine.Value = ammo.Value
  1557. ammo.Value = 0
  1558. elseif ammo.Value - magazineMax.Value >= 0 then
  1559. ammo.Value = ammo.Value - magazineMax.Value
  1560. magazine.Value = magazine.Value + magazineMax.Value
  1561. end
  1562. updateGui()
  1563. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1564. canFire = true
  1565. end
  1566. end
  1567. if key == "t" and Button1Down == false and canFire == true and canDual == true then
  1568. canFire = false
  1569. if dual == false then
  1570. local weapon = nil
  1571. for _, p in pairs(Player.Backpack:GetChildren()) do
  1572. if p.Name == Name and p ~= script.Parent then weapon = p break end
  1573. end
  1574. if weapon ~= nil then
  1575. dual = true
  1576. weapon.Name = "Dual"
  1577. weapon.Parent = script
  1578. silenced = false
  1579. removeParts("RightHand")
  1580. makeParts("RightHand")
  1581. removeParts("RightHolster")
  1582. makeParts("LeftHolster")
  1583. playAnimation("leftEquip")
  1584. removeParts("LeftHolster")
  1585. makeParts("LeftHand")
  1586. magazineMax.Value = math.ceil(magazineMax.Value * 2)
  1587. ammoMax.Value = math.ceil(ammoMax.Value * 2)
  1588. magazine.Value = magazine.Value + weapon.Magazine.Value
  1589. ammo.Value = ammo.Value + weapon.Ammo.Value
  1590. updateGui()
  1591. end
  1592. elseif dual == true then
  1593. local weapon = script:FindFirstChild("Dual")
  1594. if weapon ~= nil then
  1595. dual = false
  1596. weapon.Name = Name
  1597. weapon.Parent = Player.Backpack
  1598. silenced = false
  1599. removeParts("RightHand")
  1600. makeParts("RightHand")
  1601. playAnimation("leftUnequip")
  1602. removeParts("LeftHand")
  1603. makeParts("RightHolster")
  1604. playAnimation("hold")
  1605. weapon.Magazine.Value = math.floor(magazine.Value / 2)
  1606. weapon.Ammo.Value = math.floor(ammo.Value / 2)
  1607. magazineMax.Value = math.ceil(magazineMax.Value / 2)
  1608. ammoMax.Value = math.ceil(ammoMax.Value / 2)
  1609. magazine.Value = math.ceil(magazine.Value / 2)
  1610. ammo.Value = math.ceil(ammo.Value / 2)
  1611. updateGui()
  1612. end
  1613. end
  1614. canFire = true
  1615. end
  1616. if key == "y" and canZoom == true then
  1617. if zoom == false then
  1618. zoom = true
  1619. local pos = mouse.Hit.p
  1620. local target = mouse.Target
  1621. local cam = game:GetService("Workspace").CurrentCamera
  1622. focus = Instance.new("Part", workspace)
  1623. focus.Anchored = true
  1624. focus.CanCollide = false
  1625. focus.Transparency = 1
  1626. focus.TopSurface = 0
  1627. focus.BottomSurface = 0
  1628. focus.formFactor = "Plate"
  1629. focus.Size = Vector3.new(0, 0, 0)
  1630. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1631. cam.CameraSubject = focus
  1632. cam.CameraType = "Attach"
  1633. while zoom == true and selected == true do
  1634. local set = false
  1635. if target ~= nil then
  1636. if target.Parent ~= nil then
  1637. if target.Anchored == false then
  1638. 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)
  1639. set = true
  1640. end
  1641. end
  1642. end
  1643. if set == false then
  1644. focus.CFrame = CFrame.new(pos) * (CFrame.new(Player.Character.Torso.CFrame.p, pos) - CFrame.new(Player.Character.Torso.CFrame.p, pos).p)
  1645. end
  1646. wait()
  1647. end
  1648. if focus ~= nil then focus:Remove() focus = nil end
  1649. local cam = game:GetService("Workspace").CurrentCamera
  1650. cam.CameraSubject = Player.Character:FindFirstChild("Humanoid")
  1651. cam.CameraType = "Custom"
  1652. else
  1653. zoom = false
  1654. end
  1655. end
  1656. if key == "u" and Button1Down == false and canFire == true then
  1657. if automatic == false and burst == false then
  1658. if switchToBurst == true then
  1659. burst = true
  1660. local m = Instance.new("Message", Player)
  1661. m.Text = "Burst"
  1662. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1663. delay(2.5, function() m:Remove() end)
  1664. elseif switchToAutomatic == true then
  1665. automatic = true
  1666. local m = Instance.new("Message", Player)
  1667. m.Text = "Automatic"
  1668. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1669. delay(2.5, function() m:Remove() end)
  1670. end
  1671. elseif automatic == false and burst == true then
  1672. if switchToAutomatic == true then
  1673. automatic = true
  1674. burst = false
  1675. local m = Instance.new("Message", Player)
  1676. m.Text = "Automatic"
  1677. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1678. delay(2.5, function() m:Remove() end)
  1679. elseif switchToSingle == true then
  1680. burst = false
  1681. local m = Instance.new("Message", Player)
  1682. m.Text = "Single"
  1683. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1684. delay(2.5, function() m:Remove() end)
  1685. end
  1686. elseif automatic == true and burst == false then
  1687. if switchToSingle == true then
  1688. automatic = false
  1689. local m = Instance.new("Message", Player)
  1690. m.Text = "Single"
  1691. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1692. delay(2.5, function() m:Remove() end)
  1693. elseif switchToBurst == true then
  1694. automatic = false
  1695. burst = true
  1696. local m = Instance.new("Message", Player)
  1697. m.Text = "Burst"
  1698. pcall(function() Player.Character[Name].Handle.Switch:Play() end)
  1699. delay(2.5, function() m:Remove() end)
  1700. end
  1701. end
  1702. end
  1703. end
  1704.  
  1705.  
  1706. function onSelected(mouse)
  1707. if selected == true then return end
  1708. selected = true
  1709. Holstered = false
  1710. canFire = false
  1711. mouse.Icon = "http://www.roblox.com/asset/?id=59125642"
  1712. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1713. if Player.Character.WeaponActivated.Value == nil then break end
  1714. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1715. wait()
  1716. end
  1717. updateGui()
  1718. local weapon = Instance.new("ObjectValue")
  1719. weapon.Name = "WeaponActivated"
  1720. weapon.Value = script.Parent
  1721. weapon.Parent = Player.Character
  1722. DisableLimb(1, Player.Character)
  1723. DisableLimb(2, Player.Character)
  1724. ForceAngle(1, 0, Player.Character)
  1725. ForceAngle(2, 0, Player.Character)
  1726. if dual == true then
  1727. coroutine.resume(coroutine.create(function() playAnimation("leftEquip") end))
  1728. playAnimation("rightEquip")
  1729. removeParts("LeftHolster")
  1730. makeParts("LeftHand")
  1731. else
  1732. playAnimation("equip")
  1733. end
  1734. removeParts("RightHolster")
  1735. makeParts("RightHand")
  1736. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1737. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  1738. mouse.KeyDown:connect(function(key) onKeyDown(key, mouse) end)
  1739. mouse.Icon = "http://www.roblox.com/asset/?id=59125633"
  1740. canFire = true
  1741. end
  1742.  
  1743.  
  1744. function onDeselected(mouse)
  1745. if selected == false then return end
  1746. Holstered = true
  1747. Button1Down = false
  1748. while canFire == false do
  1749. wait()
  1750. end
  1751. selected = false
  1752. if dual == true then
  1753. if math.random(1, 2) == 1 then
  1754. coroutine.resume(coroutine.create(function() playAnimation("leftUnequip") end))
  1755. wait(math.random(1, 10) / 10)
  1756. playAnimation("rightUnequip")
  1757. else
  1758. coroutine.resume(coroutine.create(function() playAnimation("rightUnequip") end))
  1759. wait(math.random(1, 10) / 10)
  1760. playAnimation("leftUnequip")
  1761. end
  1762. removeParts("LeftHand")
  1763. makeParts("LeftHolster")
  1764. else
  1765. playAnimation("unequip")
  1766. end
  1767. removeParts("RightHand")
  1768. makeParts("RightHolster")
  1769. ForceAngle(1, 0, Player.Character)
  1770. ForceAngle(2, 0, Player.Character)
  1771. ResetLimbCFrame(1, Player.Character)
  1772. ResetLimbCFrame(2, Player.Character)
  1773. EnableLimb(1, Player.Character)
  1774. EnableLimb(2, Player.Character)
  1775. if Player.PlayerGui:FindFirstChild(Name) ~= nil then Player.PlayerGui[Name]:Remove() end
  1776. if Player.Character:FindFirstChild("WeaponActivated") ~= nil then
  1777. if Player.Character.WeaponActivated.Value == script.Parent then
  1778. Player.Character.WeaponActivated:Remove()
  1779. end
  1780. end
  1781. while Player.Character:FindFirstChild("WeaponActivated") ~= nil do
  1782. if Player.Character.WeaponActivated.Value == nil then break end
  1783. if Player.Character.WeaponActivated.Value.Parent == nil then break end
  1784. wait()
  1785. end
  1786. end
  1787.  
  1788.  
  1789. if script.Parent.className ~= "HopperBin" then
  1790. if Player == nil then print("Error: Player not found!") return end
  1791. Tool = Instance.new("HopperBin")
  1792. Tool.Name = Name
  1793. Tool.Parent = Player.Backpack
  1794. script.Name = "Main"
  1795. script.Parent = Tool
  1796. elseif script.Parent.className == "HopperBin" then
  1797. while script.Parent.Parent.className ~= "Backpack" do
  1798. wait()
  1799. end
  1800. if script.Parent:FindFirstChild("MagazineMax") == nil then
  1801. magazineMax = Instance.new("NumberValue")
  1802. magazineMax.Name = "MagazineMax"
  1803. magazineMax.Value = 50
  1804. magazineMax.Parent = script.Parent
  1805. else
  1806. magazineMax = script.Parent.MagazineMax
  1807. end
  1808. if script.Parent:FindFirstChild("Magazine") == nil then
  1809. magazine = Instance.new("NumberValue")
  1810. magazine.Name = "Magazine"
  1811. magazine.Value = 0
  1812. magazine.Parent = script.Parent
  1813. else
  1814. magazine = script.Parent.Magazine
  1815. end
  1816. if script.Parent:FindFirstChild("AmmoMax") == nil then
  1817. ammoMax = Instance.new("NumberValue")
  1818. ammoMax.Name = "AmmoMax"
  1819. ammoMax.Value = 200
  1820. ammoMax.Parent = script.Parent
  1821. else
  1822. ammoMax = script.Parent.AmmoMax
  1823. end
  1824. if script.Parent:FindFirstChild("Ammo") == nil then
  1825. ammo = Instance.new("NumberValue")
  1826. ammo.Name = "Ammo"
  1827. ammo.Value = script.Parent.AmmoMax.Value
  1828. ammo.Parent = script.Parent
  1829. else
  1830. ammo = script.Parent.Ammo
  1831. end
  1832. Player = script.Parent.Parent.Parent
  1833. makeParts("RightHolster")
  1834. script.Parent.Selected:connect(onSelected)
  1835. script.Parent.Deselected:connect(onDeselected)
  1836. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement