Advertisement
madiik

Shotface [ROBLOX]

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