fire17774

Untitled

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