Advertisement
Kaemi

Untitled

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