Advertisement
Xoxanityz

:3

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