xx_g

Roblox Epic Rpg

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