Advertisement
Chxp

Untitled

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