fire17774

Untitled

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