Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.27 KB | None | 0 0
  1. --[[
  2. Minigun
  3. Sprays an incredible number of 5mm bullets.
  4. --]]
  5.  
  6.  
  7. if script == nil then return end
  8.  
  9.  
  10. ModelName = "Minigun"
  11. AmmoType = "5mm"
  12. MagazineCapacity = 150
  13. MagazineCapacityAdd = 0
  14. Player = script:slasher1294("Player") ~= nil and script.Player.Value or game:GetService("Players"):FindFirstChild("DarkShadow6Alt")
  15. Selected = false
  16. Connected = false
  17. Button1Down = false
  18. CanUse = true
  19. Spinning = false
  20. SpinningIdle = false
  21. BulletData = [[Velocity_Transfer = 0.5
  22.  
  23. Damage_Head = 35
  24. Damage_Torso = 15
  25. Damage_Limb = 10
  26. Damage_Other = 10
  27.  
  28. Dust_Size_Min = 1
  29. Dust_Size_Max = 2
  30. Dust_Add = 0.1
  31.  
  32. Spark_Min = 2
  33. Spark_Max = 3
  34. Spark_Size_Min = 2
  35. Spark_Size_Max = 4
  36. Spark_Add = 0.15
  37.  
  38. Chunk_Min = 3
  39. Chunk_Max = 5
  40. ]] ..game:GetService("InsertService"):LoadAsset(60263276)["BulletData"].Value
  41. FirstPerson = game:GetService("InsertService"):LoadAsset(60568552)["FirstPerson"].Value
  42. MouseAim = game:GetService("InsertService"):LoadAsset(61527949)["MouseAim"].Value
  43. AmmoCounter = game:GetService("InsertService"):LoadAsset(66610412)["AmmoCounter"].Value
  44.  
  45.  
  46. function CheckPlayer()
  47. if Player.Character == nil then return false end
  48. if Player.Character:FindFirstChild("Torso") == nil or Player.Character:FindFirstChild("Right Arm") == nil or Player.Character:FindFirstChild("Left Arm") == nil or Player.Character:FindFirstChild("Humanoid") == nil then return false end
  49. if Player.Character.Humanoid.Health <= 0 then return false end
  50. return true
  51. end
  52.  
  53.  
  54. loadstring(game:GetService("InsertService"):LoadAsset(65363615)["tagHumanoid"].Value)()
  55.  
  56.  
  57. loadstring(game:GetService("InsertService"):LoadAsset(63178291)["CameraPunch"].Value)()
  58.  
  59.  
  60. loadstring(game:GetService("InsertService"):LoadAsset(62991657)["PacketFunctions"].Value)()
  61.  
  62.  
  63. function CreateParts(Parent, Format)
  64. if Parent == nil then return end
  65. local Parts = Instance.new("Model")
  66. Parts.Name = ModelName
  67. if Format == 1 then
  68. Parts.Name = Parts.Name.. " (Holstered)"
  69. end
  70. Parts.Parent = Parent
  71.  
  72. local MasterPart1 = Instance.new("Part")
  73. MasterPart1.Name = "Handle"
  74. MasterPart1.BrickColor = BrickColor.new("Black")
  75. MasterPart1.TopSurface = 0
  76. MasterPart1.BottomSurface = 0
  77. MasterPart1.FormFactor = "Custom"
  78. MasterPart1.Size = Vector3.new(1.3, 1.5, 1.3)
  79. MasterPart1.Parent = Parts
  80. local Weld = Instance.new("Weld")
  81. Weld.Part0 = MasterPart1
  82. if Format == 1 then
  83. Weld.Part1 = Player.Character:FindFirstChild("Torso")
  84. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(-85), 0, 0) * CFrame.new(-1.5, 1.5, -1)
  85. elseif Format == 2 then
  86. Weld.Part1 = Player.Character:FindFirstChild("Right Arm")
  87. Weld.C1 = CFrame.new(0.1, -2, -0.4) * CFrame.fromEulerAnglesXYZ(math.rad(50), 0, math.rad(20))
  88. end
  89. Weld.Parent = Weld.Part0
  90. Instance.new("CylinderMesh", MasterPart1).Bevel = 0.05
  91.  
  92. local Part = Instance.new("Part")
  93. Part.Name = "Grip 1"
  94. Part.BrickColor = BrickColor.new("Really black")
  95. Part.TopSurface = 0
  96. Part.BottomSurface = 0
  97. Part.FormFactor = "Custom"
  98. Part.Size = Vector3.new(0.3, 0.3, 1.1)
  99. Part.Parent = Parts
  100. local Weld = Instance.new("Weld")
  101. Weld.Part0 = Part
  102. Weld.Part1 = MasterPart1
  103. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(30), 0, 0) * CFrame.new(0, -1.2, 0)
  104. Weld.Parent = Weld.Part0
  105.  
  106. local Part = Instance.new("Part")
  107. Part.Name = " Grip 1 Trigger"
  108. Part.BrickColor = BrickColor.new("Bright red")
  109. Part.TopSurface = 0
  110. Part.BottomSurface = 0
  111. Part.FormFactor = "Custom"
  112. Part.Size = Vector3.new(0.2, 0.2, 0.3)
  113. Part.Parent = Parts
  114. local Weld = Instance.new("Weld")
  115. Weld.Part0 = Part
  116. Weld.Part1 = MasterPart1
  117. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(30), 0, 0) * CFrame.new(0, -0.95, 0.1)
  118. Weld.Parent = Weld.Part0
  119. local Mesh = Instance.new("SpecialMesh", Part)
  120. Mesh.MeshType = "Brick"
  121. Mesh.Scale = Vector3.new(0.1 / 0.2, 0.1 / 0.2, 1)
  122.  
  123. local Part = Instance.new("Part")
  124. Part.Name = "Grip 1 Top"
  125. Part.BrickColor = BrickColor.new("Really black")
  126. Part.TopSurface = 0
  127. Part.BottomSurface = 0
  128. Part.FormFactor = "Custom"
  129. Part.Size = Vector3.new(0.3, 0.4, 0.3)
  130. Part.Parent = Parts
  131. local Weld = Instance.new("Weld")
  132. Weld.Part0 = Part
  133. Weld.Part1 = MasterPart1
  134. Weld.C0 = CFrame.new(0, -0.85, 0.4)
  135. Weld.Parent = Weld.Part0
  136.  
  137. local Part = Instance.new("Part")
  138. Part.Name = "Grip 1 Bottom"
  139. Part.BrickColor = BrickColor.new("Really black")
  140. Part.TopSurface = 0
  141. Part.BottomSurface = 0
  142. Part.FormFactor = "Custom"
  143. Part.Size = Vector3.new(0.3, 0.6275, 0.3)
  144. Part.Parent = Parts
  145. local Weld = Instance.new("Weld")
  146. Weld.Part0 = Part
  147. Weld.Part1 = MasterPart1
  148. Weld.C0 = CFrame.new(0, -1.025, -0.4)
  149. Weld.Parent = Weld.Part0
  150.  
  151. local Part = Instance.new("Part")
  152. Part.Name = "Grip 2"
  153. Part.BrickColor = BrickColor.new("Really black")
  154. Part.TopSurface = 0
  155. Part.BottomSurface = 0
  156. Part.FormFactor = "Custom"
  157. Part.Size = Vector3.new(0.3, 0.3, 0.2)
  158. Part.Parent = Parts
  159. local Weld = Instance.new("Weld")
  160. Weld.Part0 = Part
  161. Weld.Part1 = MasterPart1
  162. Weld.C0 = CFrame.new(0, 0.2, 0.65)
  163. Weld.Parent = Weld.Part0
  164.  
  165. local Part = Instance.new("Part")
  166. Part.Name = "Grip 2 Ring"
  167. Part.BrickColor = BrickColor.new("Really black")
  168. Part.TopSurface = 0
  169. Part.BottomSurface = 0
  170. Part.FormFactor = "Custom"
  171. Part.Size = Vector3.new(0.8, 0.8, 0.2)
  172. Part.Parent = Parts
  173. local Weld = Instance.new("Weld")
  174. Weld.Part0 = Part
  175. Weld.Part1 = MasterPart1
  176. if Format == 1 then
  177. Weld.C0 = CFrame.new(0, -0.2, 0.65)
  178. elseif Format == 2 then
  179. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(40), 0, 0) * CFrame.new(0, -0.1, 0.9)
  180. end
  181. Weld.Parent = Weld.Part0
  182. local Mesh = Instance.new("SpecialMesh", Part)
  183. Mesh.MeshType = "FileMesh"
  184. Mesh.MeshId = "http://www.roblox.com/Asset/?id=3270017"
  185. Mesh.Scale = Vector3.new(0.9, 0.9, 0.75)
  186.  
  187. local Part = Instance.new("Part")
  188. Part.Name = "Magazine"
  189. Part.BrickColor = BrickColor.new("Camo")
  190. Part.TopSurface = 0
  191. Part.BottomSurface = 0
  192. Part.FormFactor = "Custom"
  193. Part.Size = Vector3.new(1.25, 0.6, 1)
  194. Part.Parent = Parts
  195. local Weld = Instance.new("Weld")
  196. Weld.Part0 = Part
  197. Weld.Part1 = MasterPart1
  198. Weld.C0 = CFrame.new(0.4, 0, -0.4)
  199. Weld.Parent = Weld.Part0
  200.  
  201. local MasterPart2 = Instance.new("Part")
  202. MasterPart2.Name = "Motor"
  203. MasterPart2.BrickColor = BrickColor.new("Medium stone grey")
  204. MasterPart2.TopSurface = 0
  205. MasterPart2.BottomSurface = 0
  206. MasterPart2.FormFactor = "Custom"
  207. MasterPart2.Size = Vector3.new(1, 0.1, 1)
  208. MasterPart2.Parent = Parts
  209. local Weld = Instance.new("Weld")
  210. Weld.Part0 = MasterPart2
  211. Weld.Part1 = MasterPart1
  212. Weld.C1 = CFrame.new(0, -0.75, 0.1)
  213. Weld.Parent = Weld.Part0
  214. Instance.new("CylinderMesh", MasterPart2).Bevel = 0.01
  215.  
  216. for i = 1, 5 do
  217. local Part = Instance.new("Part")
  218. Part.Name = "Barrel " ..i
  219. Part.BrickColor = BrickColor.new("Black")
  220. Part.TopSurface = 0
  221. Part.BottomSurface = 0
  222. Part.FormFactor = "Custom"
  223. Part.Size = Vector3.new(0.3, 3, 0.3)
  224. Part.Parent = Parts
  225. local Weld = Instance.new("Weld")
  226. Weld.Part0 = Part
  227. Weld.Part1 = MasterPart2
  228. Weld.C0 = CFrame.new(0, 1.6, 0.275) * CFrame.fromEulerAnglesXYZ(0, math.rad(360) * (i / 5), 0)
  229. Weld.Parent = Weld.Part0
  230. Instance.new("CylinderMesh", Part)
  231. end
  232.  
  233. for i = 1, 3 do
  234. local Part = Instance.new("Part")
  235. Part.Name = "Barrel Holder " ..i
  236. Part.BrickColor = BrickColor.new("Black")
  237. Part.TopSurface = 0
  238. Part.BottomSurface = 0
  239. Part.FormFactor = "Custom"
  240. Part.Size = Vector3.new(1, 0.2, 1)
  241. Part.Parent = Parts
  242. local Weld = Instance.new("Weld")
  243. Weld.Part0 = Part
  244. Weld.Part1 = MasterPart2
  245. Weld.C0 = CFrame.new(0, i * 0.95, 0)
  246. Weld.Parent = Weld.Part0
  247. Instance.new("CylinderMesh", Part).Bevel = 0.025
  248. end
  249.  
  250. local Part = Instance.new("Part")
  251. Part.Name = "Source"
  252. Part.TopSurface = 0
  253. Part.BottomSurface = 0
  254. Part.FormFactor = "Custom"
  255. Part.Size = Vector3.new(0.2, 0.2, 0.2)
  256. Part.CanCollide = false
  257. Part.Transparency = 1
  258. Part.Parent = Parts
  259. local Weld = Instance.new("Weld")
  260. Weld.Part0 = Part
  261. Weld.Part1 = MasterPart1
  262. Weld.C0 = CFrame.new(0, 5, 0.2)
  263. Weld.Parent = Weld.Part0
  264. local Fire = Instance.new("Fire", Part)
  265. Fire.Enabled = false
  266. Fire.Size = 9
  267. Fire.Heat = -25
  268. Fire.Color = Color3.new(1, 0.6, 0.2)
  269. Fire.SecondaryColor = Color3.new(0.6, 0.1, 0.05)
  270. local Smoke = Instance.new("Smoke", Part)
  271. Smoke.Enabled = false
  272. Smoke.Size = 14
  273. Smoke.RiseVelocity = -15
  274. Smoke.Color = Color3.new(0.8, 0.8, 0.8)
  275. Smoke.Opacity = 0.2
  276.  
  277. for _, Part in pairs(Parts:GetChildren()) do
  278. Part.Locked = true
  279. Part.CanCollide = false
  280. end
  281. end
  282.  
  283.  
  284. function RemoveParts(Parent, Format)
  285. if Format == 1 then
  286. pcall(function() Parent[ModelName.. " (Holstered)"]:Remove() end)
  287. elseif Format == 2 then
  288. pcall(function() Parent[ModelName]:Remove() end)
  289. end
  290. end
  291.  
  292.  
  293. function SetAngle(Joint, Angle, Character)
  294. if Character == nil then return false end
  295. local Joints = {
  296. Character.Torso:FindFirstChild("Right Shoulder 2"),
  297. Character.Torso:FindFirstChild("Left Shoulder 2"),
  298. Character.Torso:FindFirstChild("Right Hip 2"),
  299. Character.Torso:FindFirstChild("Left Hip 2")
  300. }
  301. if Joints[Joint] == nil then return false end
  302. if Joint == 1 or Joint == 3 then
  303. Joints[Joint].DesiredAngle = Angle
  304. end
  305. if Joint == 2 or Joint == 4 then
  306. Joints[Joint].DesiredAngle = -Angle
  307. end
  308. end
  309.  
  310.  
  311. function ForceAngle(Joint, Angle, Character)
  312. if Character == nil then return false end
  313. local Joints = {
  314. Character.Torso:FindFirstChild("Right Shoulder 2"),
  315. Character.Torso:FindFirstChild("Left Shoulder 2"),
  316. Character.Torso:FindFirstChild("Right Hip 2"),
  317. Character.Torso:FindFirstChild("Left Hip 2")
  318. }
  319. if Joints[Joint] == nil then return false end
  320. if Joint == 1 or Joint == 3 then
  321. Joints[Joint].DesiredAngle = Angle
  322. Joints[Joint].CurrentAngle = Angle
  323. end
  324. if Joint == 2 or Joint == 4 then
  325. Joints[Joint].DesiredAngle = -Angle
  326. Joints[Joint].CurrentAngle = -Angle
  327. end
  328. end
  329.  
  330.  
  331. function SetSpeed(Joint, Speed, Character)
  332. if Character == nil then return false end
  333. local Joints = {
  334. Character.Torso:FindFirstChild("Right Shoulder 2"),
  335. Character.Torso:FindFirstChild("Left Shoulder 2"),
  336. Character.Torso:FindFirstChild("Right Hip 2"),
  337. Character.Torso:FindFirstChild("Left Hip 2")
  338. }
  339. if Joints[Joint] == nil then return false end
  340. Joints[Joint].MaxVelocity = Speed
  341. end
  342.  
  343.  
  344. function DisableLimb(Limb, Character)
  345. if Character == nil then return false end
  346. if Character:FindFirstChild("Torso") == nil then return false end
  347. local Joints = {
  348. Character.Torso:FindFirstChild("Right Shoulder"),
  349. Character.Torso:FindFirstChild("Left Shoulder"),
  350. Character.Torso:FindFirstChild("Right Hip"),
  351. Character.Torso:FindFirstChild("Left Hip")
  352. }
  353. local Limbs = {
  354. Character:FindFirstChild("Right Arm"),
  355. Character:FindFirstChild("Left Arm"),
  356. Character:FindFirstChild("Right Leg"),
  357. Character:FindFirstChild("Left Leg")
  358. }
  359. if Joints[Limb] == nil then return false end
  360. if Limbs[Limb] == nil then return false end
  361. local Joint = Instance.new("Motor6D")
  362. Joint.Parent = Character.Torso
  363. Joint.Part0 = Character.Torso
  364. Joint.Part1 = Limbs[Limb]
  365. if Limb == 1 then
  366. Joint.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  367. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  368. Joint.Name = "Right Shoulder 2"
  369. elseif Limb == 2 then
  370. Joint.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  371. Joint.C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  372. Joint.Name = "Left Shoulder 2"
  373. elseif Limb == 3 then
  374. Joint.C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  375. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  376. Joint.Name = "Right Hip 2"
  377. elseif Limb == 4 then
  378. Joint.C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  379. Joint.C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  380. Joint.Name = "Left Hip 2"
  381. end
  382. Joint.MaxVelocity = Joints[Limb].MaxVelocity
  383. Joint.CurrentAngle = Joints[Limb].CurrentAngle
  384. Joint.DesiredAngle = Joints[Limb].DesiredAngle
  385. Joints[Limb]:Remove()
  386. end
  387.  
  388.  
  389. function ResetLimbCFrame(Limb, Character)
  390. if Character == nil then return false end
  391. if Character.Parent == nil then return false end
  392. if Character:FindFirstChild("Torso") == nil then return false end
  393. local Joints = {
  394. Character.Torso:FindFirstChild("Right Shoulder 2"),
  395. Character.Torso:FindFirstChild("Left Shoulder 2"),
  396. Character.Torso:FindFirstChild("Right Hip 2"),
  397. Character.Torso:FindFirstChild("Left Hip 2")
  398. }
  399. local Limbs = {
  400. Character:FindFirstChild("Right Arm"),
  401. Character:FindFirstChild("Left Arm"),
  402. Character:FindFirstChild("Right Leg"),
  403. Character:FindFirstChild("Left Leg")
  404. }
  405. if Joints[Limb] == nil then return false end
  406. if Limbs[Limb] == nil then return false end
  407. if Limb == 1 then
  408. Joints[Limb].C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  409. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  410. elseif Limb == 2 then
  411. Joints[Limb].C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  412. Joints[Limb].C1 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  413. elseif Limb == 3 then
  414. Joints[Limb].C0 = CFrame.new(0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  415. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  416. elseif Limb == 4 then
  417. Joints[Limb].C0 = CFrame.new(-0.5, -1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  418. Joints[Limb].C1 = CFrame.new(0, 1, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90), 0)
  419. end
  420. end
  421.  
  422.  
  423. function EnableLimb(Limb, Character)
  424. if Character == nil then return false end
  425. if Character:FindFirstChild("Torso") == nil then return false end
  426. local Joints = {
  427. Character.Torso:FindFirstChild("Right Shoulder 2"),
  428. Character.Torso:FindFirstChild("Left Shoulder 2"),
  429. Character.Torso:FindFirstChild("Right Hip 2"),
  430. Character.Torso:FindFirstChild("Left Hip 2")
  431. }
  432. local Limbs = {
  433. Character:FindFirstChild("Right Arm"),
  434. Character:FindFirstChild("Left Arm"),
  435. Character:FindFirstChild("Right Leg"),
  436. Character:FindFirstChild("Left Leg")
  437. }
  438. if Joints[Limb] == nil then return false end
  439. if Limbs[Limb] == nil then return false end
  440. if Limb == 1 then
  441. Joints[Limb].Name = "Right Shoulder"
  442. elseif Limb == 2 then
  443. Joints[Limb].Name = "Left Shoulder"
  444. elseif Limb == 3 then
  445. Joints[Limb].Name = "Right Hip"
  446. elseif Limb == 4 then
  447. Joints[Limb].Name = "Left Hip"
  448. end
  449. Animate = Character:FindFirstChild("Animate")
  450. if Animate == nil then return false end
  451. Animate = Animate:Clone()
  452. Character.Animate:Remove()
  453. Animate.Parent = Character
  454. end
  455.  
  456.  
  457. function SpinUp()
  458. Spinning = true
  459. SoundToServer("Spin", Button1Down == true and (script.Magazine.Value <= 0 and "http://www.roblox.com/Asset/?id=10209771" or "http://www.roblox.com/Asset/?id=10209776") or "http://www.roblox.com/Asset/?id=10209780", 1, 0, true, Player.Character[ModelName].Handle)
  460. SoundToServer("Spin Up", "http://www.roblox.com/Asset/?id=10209788", 1, 1, false, Player.Character[ModelName].Handle)
  461. for i = 0, 1, 0.05 do
  462. pcall(function() Player.Character[ModelName].Motor.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(360 * 2) * i * i, 0) end)
  463. wait()
  464. end
  465. pcall(function() Player.Character[ModelName].Handle.Spin.Volume = 1 end)
  466. coroutine.wrap(function()
  467. while Spinning == true do
  468. pcall(function() Player.Character[ModelName].Motor.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, ((tick()) % 1) * 360, 0) end)
  469. wait()
  470. end
  471. CanUse = false
  472. pcall(function() Player.Character[ModelName].Motor.Weld.C0 = CFrame.new() end)
  473. pcall(function() Player.Character[ModelName].Handle.Spin.Volume = 0 end)
  474. SendToServer([[for _, Part in pairs(Source:GetChildren()) do
  475. if Part.ClassName == "Sound" and Part.Name == "Spin" then
  476. coroutine.wrap(function()
  477. Part:Stop()
  478. wait()
  479. Part:Remove()
  480. end)()
  481. end
  482. end]], "Sound Stop", {"Source", Player.Character[ModelName].Handle})
  483. SoundToServer("Spin Down", "http://www.roblox.com/Asset/?id=10209786", 0.8, 1, false, Player.Character[ModelName].Handle)
  484. for i = 1, 0, -0.012 do
  485. pcall(function() Player.Character[ModelName].Motor.Weld.C0 = CFrame.fromEulerAnglesXYZ(0, math.rad(-360 * 10) * i * i, 0) end)
  486. wait()
  487. end
  488. CanUse = true
  489. end)()
  490. end
  491.  
  492.  
  493. function onButton1Down(Mouse)
  494. if Button1Down == true then return end
  495. Button1Down = true
  496. if CheckPlayer() == false then return end
  497. if CanUse == true then
  498. CanUse = false
  499. SoundToServer("Click", "http://www.roblox.com/Asset/?id=2697295", 15, 0.5, false, Player.Character[ModelName].Handle)
  500. if Spinning == false then
  501. SpinUp()
  502. else
  503. SendToServer([[for _, Part in pairs(Source:GetChildren()) do
  504. if Part.ClassName == "Sound" and Part.Name == "Spin" then
  505. Part:Stop()
  506. wait()
  507. Part.SoundId = "]] ..(script.Magazine.Value <= 0 and "http://www.roblox.com/Asset/?id=10209771" or "http://www.roblox.com/Asset/?id=10209776").. [["
  508. wait()
  509. Part:Play()
  510. end
  511. end]], "Sound Edit", {"Source", Player.Character[ModelName].Handle})
  512. end
  513. pcall(function()
  514. Player.Character[ModelName].Source.Fire.Enabled = true
  515. Player.Character[ModelName].Source.Smoke.Enabled = true
  516. end)
  517. while Button1Down == true and Selected == true and Spinning == true do
  518. if script.Magazine.Value <= 0 then
  519. pcall(function()
  520. if Player.Character[ModelName].Handle.Spin.SoundId ~= "http://www.roblox.com/Asset/?id=10209771" and HasSetSound ~= true then
  521. HasSetSound = true
  522. SendToServer([[for _, Part in pairs(Source:GetChildren()) do
  523. if Part.ClassName == "Sound" and Part.Name == "Spin" then
  524. Part:Stop()
  525. wait()
  526. Part.SoundId = "http://www.roblox.com/Asset/?id=10209771"
  527. wait()
  528. Part:Play()
  529. end
  530. end]], "Sound Edit", {"Source", Player.Character[ModelName].Handle})
  531. end
  532. end)
  533. pcall(function()
  534. Player.Character[ModelName].Source.Fire.Enabled = false
  535. Player.Character[ModelName].Source.Smoke.Enabled = false
  536. end)
  537. elseif script.Magazine.Value > 0 then
  538. local Bullet = Instance.new("Part", Workspace)
  539. Bullet.Name = "Bullet"
  540. Bullet.TopSurface = 0
  541. Bullet.BottomSurface = 0
  542. Bullet.BrickColor = BrickColor.new("Really black")
  543. Bullet.Locked = true
  544. Bullet.FormFactor = "Custom"
  545. Bullet.Size = Vector3.new(0.5, 0.5, 0.5)
  546. Bullet.CFrame = Player.Character[ModelName].Source.CFrame * CFrame.new(0, -5, 0)
  547. Bullet.Elasticity = 0
  548. Bullet.Friction = 0
  549. local Mesh = Instance.new("SpecialMesh", Bullet)
  550. Mesh.MeshType = "Sphere"
  551. Mesh.Scale = Vector3.new(0.1, 0.1, 0.1)
  552. tagHumanoid(Bullet)
  553. local BodyVelocity = Instance.new("BodyVelocity", Bullet)
  554. BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  555. BodyVelocity.velocity = ((Mouse.Hit.p - Player.Character[ModelName].Source.Position).unit * 200) + Vector3.new(math.random(-5000, 5000) / 1000, math.random(-5000, 5000) / 1000, math.random(-5000, 5000) / 1000)
  556. game:GetService("Debris"):AddItem(Bullet, 1.5)
  557. TouchedToServer(BulletData, Bullet)
  558. pcall(function()
  559. local Shell = Instance.new("Part", Workspace)
  560. Shell.Name = "Shell"
  561. Shell.TopSurface = 0
  562. Shell.BottomSurface = 0
  563. Shell.FormFactor = "Custom"
  564. Shell.BrickColor = BrickColor.new("New Yeller")
  565. Shell.Size = Vector3.new(0.2, 0.3, 0.2)
  566. Shell.CFrame = Player.Character[ModelName].Handle.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(math.random(0, 360)), math.rad(math.random(0, 360)), math.rad(math.random(0, 360)))
  567. Shell.Velocity = ((Player.Character[ModelName].Handle.Position - (Player.Character[ModelName].Handle.CFrame * CFrame.new(-1, 0, 0)).p).unit) * 100
  568. Shell:BreakJoints()
  569. local Mesh = Instance.new("CylinderMesh")
  570. Mesh.Scale = Vector3.new(0.4, 1, 0.4)
  571. Mesh.Parent = Shell
  572. game:GetService("Debris"):AddItem(Shell, 5)
  573. end)
  574. script.Magazine.Value = script.Magazine.Value - 1
  575. CameraPunch(math.rad(math.random(-1000, 1500) / 1000), math.rad(math.random(-1500, 1500) / 1000))
  576. end
  577. wait(0.075)
  578. end
  579. pcall(function()
  580. Player.Character[ModelName].Source.Fire.Enabled = false
  581. Player.Character[ModelName].Source.Smoke.Enabled = false
  582. end)
  583. Button1Down = false
  584. HasSetSound = false
  585. if SpinningIdle == true then
  586. SendToServer([[for _, Part in pairs(Source:GetChildren()) do
  587. if Part.ClassName == "Sound" and Part.Name == "Spin" then
  588. Part:Stop()
  589. wait()
  590. Part.SoundId = "http://www.roblox.com/Asset/?id=10209780"
  591. wait()
  592. Part:Play()
  593. end
  594. end]], "Sound Edit", {"Source", Player.Character[ModelName].Handle})
  595. CanUse = true
  596. else
  597. Spinning = false
  598. end
  599. end
  600. end
  601.  
  602.  
  603. function onButton1Up(Mouse)
  604. Button1Down = false
  605. end
  606.  
  607.  
  608. function onKeyDown(Key, Mouse)
  609. if Selected == false then return end
  610. Key = Key:lower()
  611. if Key == "e" and SpinningIdle == false then
  612. SpinningIdle = true
  613. if Spinning == false and CanUse == true then
  614. CanUse = false
  615. SpinUp()
  616. CanUse = true
  617. end
  618. end
  619. if Button1Down == false and CanUse == true and CheckPlayer() == true then
  620. if Key == "q" then
  621. if Mouse.Target == nil then return end
  622. if CheckPlayer() == false then return end
  623. local NewPlayer = game:GetService("Players"):GetPlayerFromCharacter(Mouse.Target.Parent)
  624. if NewPlayer == nil then return end
  625. if NewPlayer.Character == nil then return end
  626. if NewPlayer.Character:FindFirstChild("Torso") == nil then return end
  627. if (NewPlayer.Character.Torso.Position - Player.Character.Torso.Position).magnitude > 10 then return end
  628. onDeselected(Mouse)
  629. wait()
  630. RemoveParts(Player.Character, 1)
  631. script.Parent.Parent = NewPlayer.Backpack
  632. Player = NewPlayer
  633. elseif Key == "r" then
  634. if script.Magazine.Value >= MagazineCapacity or Player.Backpack.Ammo[AmmoType].Value <= 0 then return end
  635. CanUse = false
  636. SoundToServer("Reload 1", "http://www.roblox.com/Asset/?id=10209869", 0.4, 0.5, false, Player.Character[ModelName].Handle)
  637. pcall(function()
  638. local Clone = Player.Character[ModelName].Magazine:Clone()
  639. Clone.CanCollide = true
  640. Clone.Parent = Workspace
  641. game:GetService("Debris"):AddItem(Clone, 15)
  642. Player.Character[ModelName].Magazine.Transparency = 1
  643. end)
  644. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value + script.Magazine.Value
  645. script.Magazine.Value = 0
  646. SetSpeed(2, 0.2, Player.Character)
  647. SetAngle(2, 0, Player.Character)
  648. for i = 1, 0, -0.05 do
  649. pcall(function()
  650. Player.Character.Torso["Left Shoulder 2"].C0 =
  651. CFrame.new(-1.5 + (1.2 * i), 0.5 - (0.25 * i), -0.5 * i) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) - math.rad(40 * i), 0)
  652. Player.Character.Torso["Left Shoulder 2"].C1 =
  653. CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) + math.rad(90 * i), 0)
  654. end)
  655. CameraPunch(math.rad(-1), math.rad(1))
  656. wait()
  657. end
  658. pcall(function()
  659. local Magazine = Player.Character[ModelName].Magazine:Clone()
  660. Magazine.Name = "New Magazine"
  661. Magazine.Transparency = 0
  662. Magazine.Parent = Player.Character[ModelName]
  663. local Weld = Instance.new("Weld", Magazine)
  664. Weld.Part0 = Weld.Parent
  665. Weld.Part1 = Player.Character:FindFirstChild("Left Arm")
  666. Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(50), math.rad(-40)) * CFrame.new(0, 1, 0)
  667. end)
  668. SetSpeed(2, 0.1, Player.Character)
  669. SetAngle(2, math.rad(40), Player.Character)
  670. SoundToServer("Reload 2", "http://www.roblox.com/Asset/?id=10209801", 1, 1, false, Player.Character[ModelName].Handle)
  671. for i = 0, 1, 0.05 do
  672. pcall(function()
  673. Player.Character.Torso["Left Shoulder 2"].C0 =
  674. CFrame.new(-1.5 + (1.2 * i), 0.5 - (0.25 * i), -0.5 * i) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) - math.rad(40 * i), 0)
  675. Player.Character.Torso["Left Shoulder 2"].C1 =
  676. CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) + math.rad(90 * i), 0)
  677. Player.Character[ModelName]["New Magazine"].Weld.C0 = CFrame.fromEulerAnglesXYZ(math.rad(90), math.rad(50), math.rad(-40)) * CFrame.new(0, 1 + i, -0.5 * i)
  678. end)
  679. CameraPunch(math.rad(0), math.rad(-1))
  680. wait()
  681. end
  682. pcall(function()
  683. Player.Character[ModelName].Magazine.Transparency = 0
  684. Player.Character[ModelName]["New Magazine"]:Remove()
  685. end)
  686. if Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity < 0 then
  687. script.Magazine.Value = Player.Backpack.Ammo[AmmoType].Value
  688. Player.Backpack.Ammo[AmmoType].Value = 0
  689. else
  690. script.Magazine.Value = script.Magazine.Value + MagazineCapacity
  691. Player.Backpack.Ammo[AmmoType].Value = Player.Backpack.Ammo[AmmoType].Value - MagazineCapacity
  692. end
  693. SetAngle(2, math.rad(50), Player.Character)
  694. wait(0.2)
  695. SoundToServer("Reload 3", "http://www.roblox.com/Asset/?id=10209636", 1, 1, false, Player.Character[ModelName].Handle)
  696. for i = 0, 1, 0.1 do
  697. pcall(function()
  698. Player.Character.Torso["Left Shoulder 2"].C0 =
  699. CFrame.new(-0.3 + (0.3 * i), 0.25, -0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(-130) - math.rad(10 * i), 0)
  700. Player.Character.Torso["Left Shoulder 2"].C1 =
  701. CFrame.new(0, 0.5, 0)
  702. end)
  703. CameraPunch(math.rad(0), math.rad(-0.4))
  704. wait()
  705. end
  706. for i = 1, 0, -0.25 do
  707. pcall(function()
  708. Player.Character.Torso["Left Shoulder 2"].C0 =
  709. CFrame.new(-0.3 + (0.3 * i), 0.25, -0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(-130) - math.rad(10 * i), 0)
  710. Player.Character.Torso["Left Shoulder 2"].C1 =
  711. CFrame.new(0, 0.5, 0)
  712. end)
  713. CameraPunch(math.rad(4), math.rad(1.5))
  714. wait()
  715. end
  716. pcall(function()
  717. Player.Character.Torso["Left Shoulder 2"].C0 =
  718. CFrame.new(-0.3, 0.25, -0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(-130), 0)
  719. Player.Character.Torso["Left Shoulder 2"].C1 =
  720. CFrame.new(0, 0.5, 0)
  721. end)
  722. SetAngle(2, math.rad(80), Player.Character)
  723. wait(0.5)
  724. CanUse = true
  725. end
  726. end
  727. end
  728.  
  729.  
  730. function onKeyUp(Key, Mouse)
  731. if Selected == false then return end
  732. Key = Key:lower()
  733. if Key == "e" then
  734. SpinningIdle = false
  735. if Button1Down == false then
  736. Spinning = false
  737. end
  738. end
  739. end
  740.  
  741.  
  742. function onSelected(Mouse)
  743. if Selected == true or CanUse == false then return end
  744. CanUse = false
  745. while true do
  746. if CheckPlayer() == true then
  747. if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil and Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
  748. break
  749. end
  750. end
  751. wait(0.1)
  752. end
  753. Selected = true
  754. DisableLimb(1, Player.Character)
  755. SetSpeed(1, 0.25, Player.Character)
  756. SetAngle(1, 0, Player.Character)
  757. DisableLimb(2, Player.Character)
  758. SetSpeed(2, 0.25, Player.Character)
  759. SetAngle(2, 0, Player.Character)
  760. wait(0.5)
  761. RemoveParts(Player.Character, 1)
  762. CreateParts(Player.Character, 2)
  763. SetSpeed(1, 0.0175, Player.Character)
  764. SetAngle(1, math.rad(40), Player.Character)
  765. SetSpeed(2, 0.05, Player.Character)
  766. SetAngle(2, math.rad(80), Player.Character)
  767. for i = 0, 1, 0.025 do
  768. pcall(function()
  769. Player.Character.Torso["Right Shoulder 2"].C0 =
  770. CFrame.new(1.5 - (0.2 * i), 0.5, -0.2 * i) * CFrame.fromEulerAnglesXYZ(0, math.rad(90) + math.rad(20 * i), 0)
  771. Player.Character.Torso["Right Shoulder 2"].C1 =
  772. CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  773. Player.Character.Torso["Left Shoulder 2"].C0 =
  774. CFrame.new(-1.5 + (1.2 * i), 0.5 - (0.25 * i), -0.5 * i) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) - math.rad(40 * i), 0)
  775. Player.Character.Torso["Left Shoulder 2"].C1 =
  776. CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) + math.rad(90 * i), 0)
  777. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0.1 * (1 - i), -1.5 * (1 - i), 0.435 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-35 * (1 - i)), 0, math.rad(20 * (1 - i)))
  778. end)
  779. wait()
  780. end
  781. pcall(function()
  782. Player.Character.Torso["Right Shoulder 2"].C0 =
  783. CFrame.new(1.3, 0.5, -0.2) * CFrame.fromEulerAnglesXYZ(0, math.rad(110), 0)
  784. Player.Character.Torso["Right Shoulder 2"].C1 =
  785. CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  786. Player.Character.Torso["Left Shoulder 2"].C0 =
  787. CFrame.new(-0.3, 0.25, -0.5) * CFrame.fromEulerAnglesXYZ(0, math.rad(-130), 0)
  788. Player.Character.Torso["Left Shoulder 2"].C1 =
  789. CFrame.new(0, 0.5, 0)
  790. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new()
  791. end)
  792. Mouse.Icon = "rbxasset://textures\\GunCursor.png"
  793. Mouse.Button1Down:connect(function() onButton1Down(Mouse) end)
  794. Mouse.Button1Up:connect(function() onButton1Up(Mouse) end)
  795. Mouse.KeyDown:connect(function(Key) onKeyDown(Key, Mouse) end)
  796. Mouse.KeyUp:connect(function(Key) onKeyUp(Key, Mouse) end)
  797. CanUse = true
  798. end
  799.  
  800.  
  801. function onDeselected(Mouse)
  802. if Selected == false then return end
  803. Selected = false
  804. if Spinning == true then
  805. Spinning = false
  806. wait(0.1)
  807. end
  808. while CanUse == false do wait() end
  809. if CheckPlayer() == false or pcall(function() local _ = Player.Character.Torso["Right Shoulder 2"] end) == false then
  810. RemoveParts(Player.Character, 2)
  811. CreateParts(Player.Character, 1)
  812. SetAngle(1, 0, Player.Character)
  813. ResetLimbCFrame(1, Player.Character)
  814. EnableLimb(1, Player.Character)
  815. SetAngle(2, 0, Player.Character)
  816. ResetLimbCFrame(2, Player.Character)
  817. EnableLimb(2, Player.Character)
  818. return
  819. end
  820. if Selected == true then return end
  821. CanUse = false
  822. SetSpeed(1, 0.0175, Player.Character)
  823. SetAngle(1, 0, Player.Character)
  824. SetSpeed(2, 0.05, Player.Character)
  825. SetAngle(2, 0, Player.Character)
  826. for i = 1, 0, -0.025 do
  827. pcall(function()
  828. Player.Character.Torso["Right Shoulder 2"].C0 =
  829. CFrame.new(1.5 - (0.2 * i), 0.5, -0.2 * i) * CFrame.fromEulerAnglesXYZ(0, math.rad(90) + math.rad(20 * i), 0)
  830. Player.Character.Torso["Right Shoulder 2"].C1 =
  831. CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0)
  832. Player.Character.Torso["Left Shoulder 2"].C0 =
  833. CFrame.new(-1.5 + (1.2 * i), 0.5 - (0.25 * i), -0.5 * i) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) - math.rad(40 * i), 0)
  834. Player.Character.Torso["Left Shoulder 2"].C1 =
  835. CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0, math.rad(-90) + math.rad(90 * i), 0)
  836. Player.Character[ModelName].Handle.Weld.C0 = CFrame.new(0.1 * (1 - i), -1.5 * (1 - i), 0.435 * (1 - i)) * CFrame.fromEulerAnglesXYZ(math.rad(-35 * (1 - i)), 0, math.rad(20 * (1 - i)))
  837. end)
  838. wait()
  839. end
  840. ResetLimbCFrame(1, Player.Character)
  841. ResetLimbCFrame(2, Player.Character)
  842. EnableLimb(1, Player.Character)
  843. EnableLimb(2, Player.Character)
  844. RemoveParts(Player.Character, 2)
  845. CreateParts(Player.Character, 1)
  846. CanUse = true
  847. end
  848.  
  849.  
  850. if script.Parent.ClassName ~= "HopperBin" then
  851. if Player == nil then print("Error: Player not found!") return end
  852. Tool = Instance.new("HopperBin")
  853. Tool.Name = ModelName
  854. Tool.Parent = Player.Backpack
  855. Instance.new("IntValue", script).Name = "Magazine"
  856. script.Name = "Main"
  857. script.Parent = Tool
  858. elseif script.Parent.ClassName == "HopperBin" and Connected == false then
  859. Connected = true
  860. Player = script.Parent.Parent.Parent
  861. if Player.Backpack:FindFirstChild("Ammo") == nil then
  862. Instance.new("Configuration", Player.Backpack).Name = "Ammo"
  863. end
  864. if Player.Backpack.Ammo:FindFirstChild(AmmoType) == nil then
  865. Instance.new("IntValue", Player.Backpack.Ammo).Name = AmmoType
  866. Player.Backpack.Ammo[AmmoType].Value = MagazineCapacity * 3
  867. end
  868. script.Parent.Selected:connect(onSelected)
  869. script.Parent.Deselected:connect(onDeselected)
  870. CreateParts(Player.Character, 1)
  871. coroutine.wrap(loadstring(FirstPerson))()
  872. coroutine.wrap(loadstring(MouseAim))()
  873. coroutine.wrap(loadstring(AmmoCounter))()
  874. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement