lolita5432

Untitled

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