Advertisement
IHackShootingGames

RPG

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