NOOB-WHO-SAY-FUCK

hs

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