Advertisement
Duelmaster12345

Untitled

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