Advertisement
Chxp

Untitled

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