Advertisement
madiik

Snipeface [ROBLOX]

Sep 19th, 2013
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.66 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local char = plr.Character
  3. local mouse = plr:GetMouse()
  4. local torso = char.Torso
  5. local head = char.Head
  6. local ra = char["Right Arm"]
  7. local la = char["Left Arm"]
  8. local rl = char["Right Leg"]
  9. local ll = char["Left Leg"]
  10. local human = char["Humanoid"]
  11. local camera = workspace.CurrentCamera
  12. local rs = torso:findFirstChild("Right Shoulder")
  13. local ls = torso:findFirstChild("Left Shoulder")
  14. local neck = torso:findFirstChild("Neck")
  15. local NO_moar_shooting = false
  16. local RunService = game:service'RunService'
  17. local ammo = 4
  18. local spred = 2
  19.  
  20.  
  21. local sound = Instance.new("Sound", head)
  22. sound.SoundId = "http://roblox.com/asset/?id=10209875"
  23. sound.Volume = 1
  24. local reloads = Instance.new("Sound", head)
  25. reloads.SoundId = "http://roblox.com/asset/?id=10209636"
  26. reloads.Volume = 1
  27. local activate = Instance.new("Sound", head)
  28. activate.SoundId = "http://roblox.com/asset/?id=10209881"
  29. activate.Volume = 1
  30.  
  31.  
  32. local equipped = false
  33.  
  34. local debounce = false
  35.  
  36. local face = head.face
  37.  
  38.  
  39. release = Instance.new("Part", nil)
  40. release.FormFactor = "Custom"
  41. release.Size = Vector3.new(0.3, 1.7, 0.3)
  42. release.BrickColor = BrickColor.Black()
  43. local weld = Instance.new("Weld", release)
  44. weld.Part0 = release
  45. weld.Part1 = head
  46. weld.C0 = CFrame.new(0, -0.5, -0.2) * CFrame.Angles(math.pi/2, 0, 0)
  47. local mesh = Instance.new("CylinderMesh", release)
  48.  
  49. release2 = Instance.new("Part", nil)
  50. release2.FormFactor = "Custom"
  51. release2.Size = Vector3.new(0.2, 1.4, 0.2)
  52. release2.BrickColor = BrickColor.Black()
  53. local weld2 = Instance.new("Weld", release2)
  54. weld2.Part0 = release2
  55. weld2.Part1 = head
  56. weld2.C0 = CFrame.new(0, -0.5, -0.5) * CFrame.Angles(math.pi/2, 0, 0)
  57. local mesh2 = Instance.new("CylinderMesh", release2)
  58.  
  59. headext = Instance.new("Part", nil)
  60. headext.Position = torso.Position
  61. headext.FormFactor = "Custom"
  62. headext.Transparency = 1
  63. headext:BreakJoints()
  64. headext.Size = Vector3.new(2, 1, 1)
  65. headextw = Instance.new("Weld", headext)
  66. headextw.C0 = CFrame.new(Vector3.new(0, 1.5, 0))
  67. headextw.Part0 = torso
  68. headextw.Part1 = headext
  69. headextw.C1 = CFrame.new()
  70. headweld = Instance.new("Weld", headext)
  71. game:service("RunService").Stepped:connect(function()
  72.            headweld.C0 = CFrame.new(Vector3.new(0,0,0), torso.CFrame:pointToObjectSpace(mouse.Hit.p)) * CFrame.Angles(0, 0, 0)
  73. end)
  74. headweld.Part0 = headext
  75. headweld.C1 = CFrame.new()
  76. headweld.Part1 = head
  77.  
  78. local Screen = Instance.new("ScreenGui", plr:findFirstChild("PlayerGui"))
  79. local TextBox = Instance.new("TextLabel", Screen)
  80. TextBox.Position = UDim2.new(0.1, 0, 0.95, 0)
  81. TextBox.Size = UDim2.new(0, 200, 0.05, 0)
  82. TextBox.BackgroundTransparency = 1
  83. game:service'RunService'.Stepped:connect(function()
  84. TextBox.Text = ("Ammo: "..ammo)
  85. end)
  86. TextBox.Font = "SourceSansBold"
  87. TextBox.TextColor3 = Color3.new(1, 1, 1)
  88. TextBox.FontSize = "Size36"
  89. TextBox.TextStrokeTransparency = 0
  90.  
  91. local pl = Instance.new("PointLight", release)
  92. pl.Range = 16
  93. pl.Brightness = 5
  94. pl.Color = Color3.new(1, 199/255, 67/255)
  95. pl.Enabled = false
  96. function reload()
  97.     wait(0.2)
  98.         reloads:play()
  99.         ammo = 4
  100.         wait(1)
  101.     activate:play()
  102.     debounce = false
  103. end
  104.  
  105. mouse.KeyDown:connect(function(key)
  106.     if key == "r" then
  107.         if debounce then return end
  108.         if not equipped then return end
  109.         if ammo > 3 then return end
  110.         debounce = true
  111.         reload()
  112.     end
  113.    
  114.     if key == "q" then
  115.         equipped = not equipped
  116.         if equipped then
  117.             headext.Parent = char
  118.             release.Parent = char
  119.             release2.Parent = char
  120.             face.Parent = nil
  121.             for scale = 0, 1, 0.2 do
  122.                 weld2.C0 = CFrame.new(0, -scale + 0.5, -0.5) * CFrame.Angles(math.pi/2, 0, 0)
  123.                 weld.C0 = CFrame.new(0, -scale + 0.5, -0.2) * CFrame.Angles(math.pi/2, 0, 0)
  124.                 mesh.Scale = Vector3.new(1, scale, 1)
  125.                 mesh2.Scale = Vector3.new(1, scale, 1)
  126.                 wait()
  127.                 end
  128.         else
  129.             face.Parent = head
  130.             release.Parent = nil
  131.             release2.Parent = nil
  132.             headext.Parent = nil
  133.         end
  134.     end
  135. end)
  136.  
  137. mouse.Button1Down:connect(function()
  138.     if not equipped then return end
  139.     if ammo < 1 then return end
  140.             if debounce then return end
  141.             debounce = true
  142.             sound:play()
  143.             pl.Enabled = true
  144.             ammo = ammo - 1
  145.             coroutine.wrap(function()
  146.                 wait(0.5)
  147.                     activate:play()
  148.                     end)()
  149.             coroutine.wrap(function()
  150.                 wait(0.07)
  151.                 pl.Enabled = false
  152.                 end)()
  153.             coroutine.wrap(function()
  154.                 for scale = 0.7, 1, 0.1 do
  155.                     mesh.Scale = Vector3.new(1, scale, 1)
  156.                     wait()
  157.                 end
  158.             end)()
  159.            
  160.                 coroutine.wrap(function()
  161.     if char.Humanoid.Health < 1 then return end
  162.     local rayPart         = Instance.new("Part", char)
  163.     rayPart.Name          = "RayPart"
  164.     rayPart.BrickColor    = BrickColor.Yellow()
  165.     rayPart.Anchored      = true
  166.     rayPart.CanCollide    = false
  167.     rayPart.TopSurface    = Enum.SurfaceType.Smooth
  168.     rayPart.BottomSurface = Enum.SurfaceType.Smooth
  169.     rayPart.formFactor    = Enum.FormFactor.Custom
  170.     rayPart.Size          = Vector3.new(0.2, 0.2, 4)
  171. Instance.new("BlockMesh", rayPart).Scale = Vector3.new(0.2, 0.2, 0.5)
  172.    
  173.    
  174.    
  175.     local bulletposition = release.Position
  176.    local bulletvelocity = (Vector3.new(math.random(-spred,spred), math.random(-spred,spred), math.random(-spred,spred)))+( mouse.Hit.p - bulletposition).unit*200
  177.     local bulletlastposition = bulletposition
  178.     rayPart.CFrame = CFrame.new( bulletposition, bulletposition+bulletvelocity )
  179.  
  180.  
  181.  
  182.  
  183.    
  184.     coroutine.resume(coroutine.create(function()
  185.         while true do
  186.             local dt = wait()
  187.             bulletlastposition = bulletposition
  188.             bulletvelocity = bulletvelocity + (Vector3.new(0, -9.81*5, 0)*dt)
  189.             bulletposition = bulletposition + (bulletvelocity*dt)
  190.                
  191.             local ray = Ray.new(bulletlastposition,  (bulletposition - bulletlastposition))
  192.             local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayPart} )
  193.                
  194.     if (torso.Position - rayPart.Position).magnitude > 440 then
  195.         rayPart:Destroy()
  196.      break
  197.      end
  198.    
  199.    
  200.             if hit then
  201.                 if hit.Parent:findFirstChild("Humanoid") ~= nil then
  202.                     hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - math.random(30, 85)
  203.                 end
  204.                 if hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then
  205.                     hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - math.random(30, 85)
  206.                     end
  207.                 bulletposition = hitposition
  208.                 rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
  209.                 rayPart:Destroy()
  210.                 break
  211.             end
  212.             rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
  213.         end
  214.     end))
  215.                 end)()
  216.         wait(0.8)
  217.             debounce = false
  218.        
  219. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement