Advertisement
D0MiN0_FX

Izmech Revolver

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