TheProNoob2004

RPG-7

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