wanTH092

SHOTGUN

Jul 4th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.83 KB | None | 0 0
  1. -- Shotgun by KirkyTurky12
  2. local Player = game.Players.LocalPlayer
  3. Player.CameraMode = "Classic"
  4. --Player.CameraMode = "LockFirstPerson"
  5. local Camera = workspace.CurrentCamera
  6. Camera:ClearAllChildren()
  7. local Char = Player.Character
  8. local Torso = Char.Torso
  9. local Mouse = Player:GetMouse()
  10. local Active = true
  11. local Weld = Instance.new("Weld",Torso)
  12. Weld.Part0 = Torso
  13. Weld.Part1 = Char.Head
  14. local RA = Char["Right Arm"]
  15. local Weld2 = Instance.new("Weld",Torso)
  16. Weld2.Part0 = Torso
  17. Weld2.Part1 = RA
  18. Weld2.C1 = CFrame.new(0,0.5,0.25) * CFrame.Angles(math.rad(-90),math.rad(-35),0)
  19. local LA = Char["Left Arm"]
  20. local Weld3 = Instance.new("Weld",Torso)
  21. Weld3.Part0 = Torso
  22. Weld3.Part1 = LA
  23. Weld3.C1 = CFrame.new(0,0.5,0.25) * CFrame.Angles(math.rad(-90),math.rad(35),0)
  24. local FRA = Char["Right Arm"]:Clone()
  25. Instance.new("SpecialMesh",FRA).MeshId = "http://www.roblox.com/Asset/?id=27111864"
  26. --FRA.Transparency = 0.25
  27. FRA.Parent = Camera
  28. local Weld4 = Instance.new("Weld",Char.Head)
  29. Weld4.Part0 = Char.Head
  30. Weld4.Part1 = FRA
  31. Weld4.C0 = CFrame.new(1.5, -1, -0.2) * CFrame.Angles(math.rad(90), 0, math.rad(-35))
  32. local FLA = Char["Left Arm"]:Clone()
  33. Instance.new("SpecialMesh",FLA).MeshId = "http://www.roblox.com/Asset/?id=27111419"
  34. --FLA.Transparency = 0.25
  35. FLA.Parent = Camera
  36. local Weld5 = Instance.new("Weld",Char.Head)
  37. Weld5.Part0 = Char.Head
  38. Weld5.Part1 = FLA
  39. Weld5.C0 = CFrame.new(0.15,-1,-1)*CFrame.Angles(math.rad(90),0,math.rad(35))
  40. local Handle = Instance.new("Part",Camera)
  41. Handle.FormFactor = "Custom"
  42. Handle.CanCollide = false
  43. Handle.Size = Vector3.new(0.3,3,0.3)
  44. Handle.TopSurface = "Smooth"
  45. Handle.BottomSurface = "Smooth"
  46. Instance.new("CylinderMesh",Handle)
  47. Handle:BreakJoints()
  48. local Weld4 = Instance.new("Weld",FRA)
  49. Weld4.Part0 = FRA
  50. Weld4.Part1 = Handle
  51. Weld4.C0 = (CFrame.new(-0.3,-0.75,0) * CFrame.Angles(math.rad(0),0,math.rad(35))) * CFrame.new(0,-1.5,-0.5)
  52. local Stock = Instance.new("Part",Camera)
  53. Stock.FormFactor = "Custom"
  54. Stock.CanCollide = false
  55. Stock.Size = Vector3.new(0.3,1.5,0.5)
  56. Stock.BrickColor = BrickColor.new("Brown")
  57. Stock.TopSurface = "Smooth"
  58. Stock.BottomSurface = "Smooth"
  59. Stock:BreakJoints()
  60. local Weld4 = Instance.new("Weld",Handle)
  61. Weld4.Part0 = Handle
  62. Weld4.Part1 = Stock
  63. Weld4.C0 = CFrame.new(0,1.5,0.12)
  64. local Handle2 = Instance.new("Part",Char)
  65. Handle2.FormFactor = "Custom"
  66. Handle2.CanCollide = false
  67. Handle2.Size = Vector3.new(0.3,3,0.3)
  68. Handle2.TopSurface = "Smooth"
  69. Handle2.BottomSurface = "Smooth"
  70. Instance.new("CylinderMesh",Handle2)
  71. Handle2:BreakJoints()
  72. local Weld4 = Instance.new("Weld",RA)
  73. Weld4.Part0 = RA
  74. Weld4.Part1 = Handle2
  75. Weld4.C0 = (CFrame.new(-0.3,-0.75,0) * CFrame.Angles(math.rad(0),0,math.rad(35))) * CFrame.new(0,-1.5,-0.5)
  76. local Stock2 = Instance.new("Part",Char)
  77. Stock2.FormFactor = "Custom"
  78. Stock2.CanCollide = false
  79. Stock2.Size = Vector3.new(0.3,1.5,0.5)
  80. Stock2.BrickColor = BrickColor.new("Brown")
  81. Stock2.TopSurface = "Smooth"
  82. Stock2.BottomSurface = "Smooth"
  83. Stock2:BreakJoints()
  84. local Weld4 = Instance.new("Weld",Handle2)
  85. Weld4.Part0 = Handle2
  86. Weld4.Part1 = Stock2
  87. Weld4.C0 = CFrame.new(0,1.5,0.12)
  88. function CameraRecoil(Amount)
  89.                 local RecoilVector = Vector3.new()
  90.                 local XYZRandom = math.random(1,3)
  91.                 local XYZRandom2
  92.                 repeat XYZRandom2 = math.random(1,3) until XYZRandom2 ~= XYZRandom
  93.                 local NegativeRandom = math.random(1,2)
  94.                         if (XYZRandom==1) then
  95.                         RecoilVector = Vector3.new(Amount/100,0,0)
  96.                         elseif (XYZRandom==2) then
  97.                         RecoilVector = Vector3.new(0,Amount/100,0)
  98.                         elseif (XYZRandom==3) then
  99.                         RecoilVector = Vector3.new(0,0,Amount/100)
  100.                         end
  101.                         if (XYZRandom2==1) then
  102.                         RecoilVector = RecoilVector+Vector3.new(Amount/100,0,0)
  103.                         elseif (XYZRandom2==2) then
  104.                         RecoilVector = RecoilVector+Vector3.new(0,Amount/100,0)
  105.                         elseif (XYZRandom2==3) then
  106.                         RecoilVector = RecoilVector+Vector3.new(0,0,Amount/100)
  107.                         end
  108.                         if (NegativeRandom==2) then
  109.                         RecoilVector = RecoilVector*Vector3.new(-1,-1,-1)
  110.                         end
  111.                         local FoVFactor = -2
  112.                         Spawn(function()
  113.                                 for i = 1, 2 do
  114.                                 Camera.Focus = game.Workspace.CurrentCamera.Focus - RecoilVector/2
  115.                                 Camera.FieldOfView = Camera.FieldOfView + FoVFactor / 2
  116.                                 wait(1/30)
  117.                                 end
  118.                                 for i = 1, 6 do
  119.                                 Camera.Focus = game.Workspace.CurrentCamera.Focus + RecoilVector/6
  120.                                 Camera.FieldOfView = Camera.FieldOfView - FoVFactor / 6
  121.                                 wait(1/30)
  122.                                 end
  123.                         end)
  124. end
  125. function FireBullet(Start,End,RandomScale)
  126.         coroutine.resume(coroutine.create(function()
  127.                 local Bullet = Instance.new("Part",Camera)
  128.                 Bullet.Anchored = true
  129.                 Bullet.CanCollide = false
  130.                 Bullet.FormFactor = "Custom"
  131.                 Bullet.Size = Vector3.new(0,0,2)
  132.                 Bullet.BrickColor = BrickColor.new("Bright yellow")
  133.                 Bullet.CFrame = CFrame.new(Start.p,End.p+Vector3.new(math.random(-RandomScale,RandomScale)*0.1,math.random(-RandomScale,RandomScale)*0.1,math.random(-RandomScale,RandomScale)*0.1))
  134.                 for i = 1,30 do
  135.                         for i2 = 1,10 do
  136.                                 Reg = Region3.new(Bullet.Position-Vector3.new(Bullet.Size.X/2,Bullet.Size.Y/2,Bullet.Size.Z/2),Bullet.Position+Vector3.new(Bullet.Size.X/2,Bullet.Size.Y/2,Bullet.Size.Z/2))
  137.                                 local Results = workspace:FindPartsInRegion3WithIgnoreList(Reg,{Char,Camera,Bullet},1)
  138.                                 if #Results == 0 then
  139.                                         Bullet.CFrame = Bullet.CFrame*CFrame.new(0,0,-2) * CFrame.Angles(math.rad(-0.025),0,0)
  140.                                 else
  141.                                         local Hit = Results[1]
  142.                                         local Pos = Bullet.CFrame
  143.                                         local Hole = Instance.new("Part",workspace)
  144.                                         Hole.Anchored = true
  145.                                         Hole.FormFactor = "Custom"
  146.                                         Hole.CanCollide = false
  147.                                         Hole.BrickColor = BrickColor.new("Black")
  148.                                         Hole.Size = Vector3.new(0.3,0.3,0.3)
  149.                                         Hole.CFrame = Pos+Vector3.new(0,0.1,0)
  150.                                         Bullet:Destroy()
  151.                                         if Hit.Parent:FindFirstChild("Humanoid") then
  152.                                                 Hit.Parent.Humanoid.Health = Hit.Parent.Humanoid.Health-50
  153.                                         elseif Hit.Parent:IsA("Hat") then
  154.                                                 Hit:BreakJoints()
  155.                                         end
  156.                                         wait(5)
  157.                                         for i = 0,1,0.1 do
  158.                                                 Hole.Transparency = i
  159.                                                 wait(0.001)
  160.                                         end
  161.                                         Hole:Destroy()
  162.                                         break
  163.                                 end
  164.                         end
  165.                         if Bullet.Parent == nil then
  166.                                 break
  167.                         end
  168.                         wait(0.0000001)
  169.                 end
  170.                 Bullet:Destroy()
  171.         end))
  172. end
  173. local WalkUpDown = 0
  174. local WalkLeftRight = 0        
  175. local WDown = false
  176. local ADown = false
  177. local SDown = false
  178. local DDown = false
  179. local DB = false
  180. Mouse.Button1Down:connect(function()
  181.         if not DB then
  182.                 DB = true
  183.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,1)
  184.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,4)
  185.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,7)
  186.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,10)
  187.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,13)
  188.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,16)
  189.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,19)
  190.                 FireBullet(Handle.CFrame*CFrame.new(0,1.5,0),Mouse.Hit,22)
  191.                 CameraRecoil(5)
  192.                 wait(0.25)
  193.                 DB = false
  194.         end
  195. end)
  196. Mouse.KeyDown:connect(function(Key)
  197.         if Key:lower() == "w" then
  198.                 WDown = true
  199.         elseif Key:lower() == "a" then
  200.                 ADown = true
  201.         elseif Key:lower() == "s" then
  202.                 SDown = true
  203.         elseif Key:lower() == "d" then
  204.                 DDown = true
  205.         end
  206. end)
  207. Mouse.KeyUp:connect(function(Key)
  208.         if Key:lower() == "w" then
  209.                 WDown = false
  210.         elseif Key:lower() == "a" then
  211.                 ADown = false
  212.         elseif Key:lower() == "s" then
  213.                 SDown = false
  214.         elseif Key:lower() == "d" then
  215.                 DDown = false
  216.         end
  217. end)
  218. function DoIt()
  219.         if WDown then
  220.                 WalkUpDown = WalkUpDown+2
  221.                 WalkUpDown = WalkUpDown > 10 and 10 or WalkUpDown
  222.         elseif SDown then
  223.                 WalkUpDown = WalkUpDown-2
  224.                 WalkUpDown = WalkUpDown < -10 and -10 or WalkUpDown
  225.         else
  226.                 if WalkUpDown > 0 then
  227.                         WalkUpDown = WalkUpDown-2
  228.                         WalkUpDown = WalkUpDown < 0 and 0 or WalkUpDown
  229.                 elseif WalkUpDown < 0 then
  230.                         WalkUpDown = WalkUpDown+2
  231.                         WalkUpDown = WalkUpDown > 0 and 0 or WalkUpDown
  232.                 end
  233.         end
  234.         if ADown then
  235.                 WalkLeftRight = WalkLeftRight+2
  236.                 WalkLeftRight = WalkLeftRight > 10 and 10 or WalkLeftRight
  237.         elseif DDown then
  238.                 WalkLeftRight = WalkLeftRight-2
  239.                 WalkLeftRight = WalkLeftRight < -10 and -10 or WalkLeftRight
  240.         else
  241.                 if WalkLeftRight > 0 then
  242.                         WalkLeftRight = WalkLeftRight-2
  243.                         WalkLeftRight = WalkLeftRight < 0 and 0 or WalkLeftRight
  244.                 elseif WalkLeftRight < 0 then
  245.                         WalkLeftRight = WalkLeftRight+2
  246.                         WalkLeftRight = WalkLeftRight > 0 and 0 or WalkLeftRight
  247.                 end
  248.         end
  249.         if Active then
  250.                 local Target = Camera.CoordinateFrame * CFrame.new(0,-WalkUpDown,-100)--CFrame.new(Left/Right ratio, Up/Down ratio, ignore/unknown)
  251.                 local Pos = Torso.CFrame:pointToObjectSpace(Target.p)
  252.                 Weld.C0 = (CFrame.new(Vector3.new(0,1.5,0),Vector3.new(0,Pos.Y,Pos.Z))) * CFrame.Angles(0,0,math.rad(WalkLeftRight))
  253.                 local Yus = 0.5+Pos.Y/400
  254.                 Weld2.C0 = CFrame.new(Vector3.new(1,Yus,0.25),Vector3.new(0,Pos.Y,Pos.Z))
  255.                 Weld3.C0 = CFrame.new(Vector3.new(-0.8,Yus,-0.75),Vector3.new(0,Pos.Y,Pos.Z))
  256.                 local TorsoTarget = CFrame.new(Target.x, Torso.CFrame.y, Target.z)
  257.                 Torso.CFrame = CFrame.new(Torso.CFrame.p, TorsoTarget.p)
  258.         end
  259.         --wait(0.000001)
  260. end
  261. game:GetService("RunService").Stepped:connect(DoIt)
  262. Mouse.Move:connect(DoIt)
Add Comment
Please, Sign In to add comment