Advertisement
jc7244

Test

Jan 19th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local chr = plr.Character or plr.CharacterAdded:wait()
  3. local running = false
  4. function new(classname)
  5. return Instance.new(classname)
  6. end
  7.  
  8. chr:WaitForChild("Right Leg")
  9.  
  10. local pistol = {gun={}}
  11. pistol.gun.Handle = new("Part", chr)
  12. pistol.gun.Handle.Size = Vector3.new(0.2, 0.8, 0.8)
  13. pistol.gun.Mesh = new("SpecialMesh")
  14. pistol.gun.Mesh.MeshType = Enum.MeshType.FileMesh
  15. pistol.gun.Mesh.MeshId = "http://www.roblox.com/asset/?id=31656135"
  16. pistol.gun.Mesh.TextureId = "http://www.roblox.com/asset/?id=31656155"
  17. pistol.gun.Mesh.Scale = Vector3.new(1.25,1.25,1.25)
  18. pistol.gun.Mesh.Parent = pistol.gun.Handle
  19. pistol.gun.Handle.CanCollide = false
  20. pistol.gun.Handle.Anchored = true
  21. pistol.gun.Handle.Parent = workspace
  22. pistol.gun.Sound = new("Sound")
  23. pistol.gun.Sound.SoundId = "rbxassetid://1584160525"
  24. pistol.gun.Sound.Parent = pistol.gun.Handle
  25. wait()
  26. pistol.gun.CFrame = chr["Right Leg"].CFrame
  27. local w = Instance.new("Weld",chr["Right Leg"])
  28. w.Part0 = pistol.gun.Handle
  29. w.Part1 = chr["Right Leg"]
  30. w.C0 = chr["Right Leg"].CFrame
  31. w.C1 = CFrame.new(0.6,0.5,0) * CFrame.Angles(math.rad(180),0,0) * chr["Right Leg"].CFrame
  32. pistol.gun.Handle.Anchored = false
  33.  
  34. local il = {chr,pistol.gun.Handle}
  35.  
  36. function fire(start,stop)
  37. pistol.gun.Sound:play()
  38. local part,pos = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(start,(stop-start).unit*90),il)
  39. local bullet = new("Part")
  40. table.insert(il,bullet)
  41. bullet.BrickColor = BrickColor.new("Light blue")
  42. bullet.FormFactor = "Custom"
  43. bullet.Anchored = true
  44. bullet.CanCollide = false
  45. bullet.Size = Vector3.new(0.1, 0.1, (start - pos).magnitude)
  46. bullet.CFrame = CFrame.new(start, pos) * CFrame.new(0, 0, -(start - pos).magnitude / 2)
  47. bullet.Parent = game.Workspace
  48. local bm = new("BlockMesh")
  49. bm.Scale = Vector3.new(.5,.5,1)
  50. bm.Parent = bullet
  51. if part ~= nil then
  52. if part.Parent:findFirstChild("Humanoid") then
  53. part.Parent:BreakJoints()
  54. end
  55. end
  56. spawn(function() wait(.07) bullet:Destroy() end)
  57. end
  58.  
  59. game:GetService("UserInputService").InputBegan:connect(function(inp,gpe)
  60. if not gpe then
  61. if inp.UserInputType == Enum.UserInputType.Keyboard then
  62. if inp.KeyCode == Enum.KeyCode.E then
  63. if running == false then
  64. running = true
  65. chr.Humanoid.WalkSpeed = 0
  66. w.Part1 = chr["Right Arm"]
  67. w.C0 = chr["Right Arm"].CFrame
  68. w.C1 = CFrame.new(0,-1.4,-.4) * CFrame.Angles(math.rad(180),0,0) * chr["Right Arm"].CFrame
  69. local w2 = new("Weld")
  70. w2.Name = "Right_Weld"
  71. w2.Parent = chr.HumanoidRootPart
  72. w2.Part0 = chr.HumanoidRootPart
  73. w2.Part1 = chr["Right Arm"]
  74. w2.C1 = CFrame.new(-.5, 2, 0) * CFrame.fromEulerAnglesXYZ(0, 0, math.rad(-90))
  75. wait(1)
  76. for i = 1,45 do
  77. if i%3 == 0 then
  78. fire(pistol.gun.Handle.CFrame.p,(pistol.gun.Handle.CFrame * CFrame.Angles(math.rad(90),0,0)).lookVector*100)
  79. end
  80. chr.Torso.CFrame = chr.Torso.CFrame * CFrame.Angles(0,math.rad(8),0)
  81. wait(.01)
  82. end
  83. wait(.5)
  84. chr.Humanoid.WalkSpeed = 16
  85. w2:Destroy()
  86. w.Part1 = chr["Right Leg"]
  87. w.C0 = chr["Right Leg"].CFrame
  88. w.C1 = CFrame.new(0.6,0.5,0) * CFrame.Angles(math.rad(180),0,0) * chr["Right Leg"].CFrame
  89. wait(1)
  90. running = false
  91. end
  92. end
  93. end
  94. end
  95. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement