Advertisement
DylanD2003

Untitled

Jun 26th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.18 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.0, 0.0, 0.0)
  41. release.BrickColor = BrickColor.Black()
  42. local weld = Instance.new("Weld", release)
  43. weld.Part0 = release
  44. release.Locked = true
  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.0, 0.0, 0.0)
  52. release2.BrickColor = BrickColor.Black()
  53. release2.Locked = true
  54. local weld2 = Instance.new("Weld", release2)
  55. weld2.Part0 = release2
  56. weld2.Part1 = head
  57. weld2.C0 = CFrame.new(0, -0.5, 0) * CFrame.Angles(math.pi/2, 0, 0)
  58. local mesh2 = Instance.new("CylinderMesh", release2)
  59.  
  60. headext = Instance.new("Part", nil)
  61. headext.Position = torso.Position
  62. headext.FormFactor = "Custom"
  63. headext.Transparency = 1
  64. headext:BreakJoints()
  65. headext.Size = Vector3.new(2, 1, 1)
  66. headextw = Instance.new("Weld", headext)
  67. headextw.C0 = CFrame.new(Vector3.new(0, 1.5, 0))
  68. headextw.Part0 = torso
  69. headextw.Part1 = headext
  70. headextw.C1 = CFrame.new()
  71. headweld = Instance.new("Weld", headext)
  72. game:service("RunService").Stepped:connect(function()
  73. headweld.C0 = CFrame.new(Vector3.new(0,0,0), torso.CFrame:pointToObjectSpace(mouse.Hit.p)) * CFrame.Angles(0, 0, 0)
  74. end)
  75. headweld.Part0 = headext
  76. headweld.C1 = CFrame.new()
  77. headweld.Part1 = head
  78.  
  79. local Screen = Instance.new("ScreenGui", plr:findFirstChild("PlayerGui"))
  80. local TextBox = Instance.new("TextLabel", Screen)
  81. TextBox.Position = UDim2.new(0.1, 0, 0.95, 0)
  82. TextBox.Size = UDim2.new(0, 200, 0.05, 0)
  83. TextBox.BackgroundTransparency = 1
  84. game:service'RunService'.Stepped:connect(function()
  85. TextBox.Text = ("Ammo: "..ammo)
  86. end)
  87. TextBox.Font = "SourceSansBold"
  88. TextBox.TextColor3 = Color3.new(1, 1, 1)
  89. TextBox.FontSize = "Size36"
  90. TextBox.TextStrokeTransparency = 0
  91.  
  92. local pl = Instance.new("PointLight", release)
  93. pl.Range = 16
  94. pl.Brightness = 5
  95. pl.Color = Color3.new(1, 199/255, 67/255)
  96. pl.Enabled = false
  97. function reload()
  98. if ammo > 7 then return end
  99. reloads:play()
  100. ammo = ammo + 1
  101. activate:play()
  102. wait(0.3)
  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. for scale = 0, 1, 0.2 do
  122. weld2.C0 = CFrame.new(0, -scale + 0.5, 0) * 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.07)
  147. pl.Enabled = false
  148. end)()
  149. coroutine.wrap(function()
  150. for scale = 0.7, 1, 0.1 do
  151. mesh.Scale = Vector3.new(1, scale, 1)
  152. wait()
  153. end
  154. end)()
  155.  
  156. local shell = Instance.new("Part", workspace)
  157. shell.BrickColor = BrickColor.Red()
  158. shell.FormFactor = "Custom"
  159. shell.Size = Vector3.new(0.3, 0.7, 0.3)
  160. shell.CFrame = head.CFrame * CFrame.new(0, 0.1, 0.5) * CFrame.Angles(math.pi/2, 0, math.pi/2)
  161. local bodyF = Instance.new("BodyVelocity", shell)
  162. bodyF.maxForce = Vector3.new(1e5, 0, 1e5)
  163. bodyF.P = 1e3
  164. bodyF.velocity = head.CFrame.lookVector * -20
  165. Instance.new("CylinderMesh", shell)
  166.  
  167. local shell2 = Instance.new("Part", shell)
  168. shell2.BrickColor = BrickColor.Yellow()
  169. shell2.FormFactor = "Custom"
  170. shell2.Size = Vector3.new(0.3, 0.2, 0.3)
  171. shell2:BreakJoints()
  172. local weld = Instance.new("Weld", shell2)
  173. weld.Part0 = shell2
  174. weld.Part1 = shell
  175. weld.C0 = CFrame.new(0, 0.45, 0)
  176. Instance.new("CylinderMesh", shell2)
  177. coroutine.wrap(function()
  178. wait(0.2)
  179. bodyF:Destroy()
  180. wait(4.8)
  181.  
  182. for _ = 0, 5 do
  183. shell.Mesh.Scale = shell.Mesh.Scale + Vector3.new(0.2, 0.2, 0.2)
  184. shell.Transparency = shell.Transparency + 0.2
  185. shell2.Mesh.Scale = shell.Mesh.Scale + Vector3.new(0.2, 0.2, 0.2)
  186. shell2.Transparency = shell.Transparency + 0.2
  187. wait()
  188. end
  189.  
  190. shell:Destroy()
  191. end)()
  192.  
  193. for bullet = 0, 5 do
  194. coroutine.wrap(function()
  195. if char.Humanoid.Health < 1 then return end
  196. local rayPart = Instance.new("Part")
  197. rayPart.Name = "RayPart"
  198. rayPart.BrickColor = BrickColor.Yellow()
  199. rayPart.Anchored = true
  200. rayPart.CanCollide = false
  201. rayPart.Locked = true
  202. rayPart.TopSurface = Enum.SurfaceType.Smooth
  203. rayPart.BottomSurface = Enum.SurfaceType.Smooth
  204. rayPart.formFactor = Enum.FormFactor.Custom
  205. rayPart.Size = Vector3.new(0.2, 0.2, 4)
  206. Instance.new("BlockMesh", rayPart).Scale = Vector3.new(0.2, 0.2, 0.5)
  207.  
  208.  
  209.  
  210. local bulletposition = release.Position
  211. local bulletvelocity = (Vector3.new(math.random(-7,7), math.random(-7,7), math.random(-7,7)))+( mouse.Hit.p - bulletposition).unit*150
  212. local bulletlastposition = bulletposition
  213. rayPart.CFrame = CFrame.new( bulletposition, bulletposition+bulletvelocity )
  214.  
  215.  
  216.  
  217.  
  218.  
  219. coroutine.resume(coroutine.create(function()
  220. while true do
  221. local dt = wait()
  222. bulletlastposition = bulletposition
  223. bulletvelocity = bulletvelocity + (Vector3.new(0, -9.81*10, 0)*dt)
  224. bulletposition = bulletposition + (bulletvelocity*dt)
  225. rayPart.Parent = workspace
  226.  
  227. local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition))
  228. local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayPart} )
  229.  
  230. if (torso.Position - rayPart.Position).magnitude > 440 then
  231. rayPart:Destroy()
  232. break
  233. end
  234.  
  235.  
  236. if hit then
  237. local damage = math.random(6, 11)
  238. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  239. hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
  240. coroutine.wrap(function()
  241. local prt = Instance.new("Part", char)
  242. prt.FormFactor = "Custom"
  243. prt.Size = Vector3.new(0.1, 0.1, 0.1)
  244. prt.Transparency = 1
  245. prt.CanCollide = false
  246. prt.CFrame = CFrame.new(rayPart.CFrame.x, rayPart.CFrame.y, rayPart.CFrame.z)
  247. prt.Anchored = true
  248. coroutine.resume(coroutine.create(function()
  249. for i = 2, 10, 0.1 do
  250. if prt == nil then return end
  251. prt.CFrame = prt.CFrame * CFrame.new(0, 0.05, 0)
  252. game:service'RunService'.Stepped:wait()
  253. end
  254. end))
  255.  
  256. local bg = Instance.new("BillboardGui")
  257. bg.Parent = prt
  258. bg.Adornee = prt
  259. bg.Size = UDim2.new(4, 0, 3.5, 0)
  260. bg.ExtentsOffset = Vector3.new(0, 0, 0)
  261. local lol = Instance.new("TextLabel")
  262. lol.Size = UDim2.new(1.3, 0, 0.4, 0)
  263. lol.TextScaled = true
  264. lol.TextWrapped = true
  265. lol.BackgroundTransparency = 1
  266. lol.Parent = bg
  267. lol.FontSize = "Size24"
  268. lol.TextColor3 = Color3.new(1, 0, 0)
  269. lol.TextStrokeTransparency = 0
  270. lol.Font = "ArialBold"
  271. lol.Text = "-"..damage
  272.  
  273. wait(3)
  274. prt:Destroy()
  275. end)()
  276. end
  277. if hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then
  278. hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage
  279. coroutine.wrap(function()
  280. local prt = Instance.new("Part", char)
  281. prt.FormFactor = "Custom"
  282. prt.Size = Vector3.new(0.1, 0.1, 0.1)
  283. prt.Transparency = 1
  284. prt.CanCollide = false
  285. prt.CFrame = CFrame.new(rayPart.CFrame.x, rayPart.CFrame.y, rayPart.CFrame.z)
  286. prt.Anchored = true
  287. coroutine.resume(coroutine.create(function()
  288. for i = 2, 10, 0.1 do
  289. if prt == nil then return end
  290. prt.CFrame = prt.CFrame * CFrame.new(0, 0.05, 0)
  291. game:service'RunService'.Stepped:wait()
  292. end
  293. end))
  294.  
  295. local bg = Instance.new("BillboardGui")
  296. bg.Parent = prt
  297. bg.Adornee = prt
  298. bg.Size = UDim2.new(4, 0, 3.5, 0)
  299. bg.ExtentsOffset = Vector3.new(0, 0, 0)
  300. local lol = Instance.new("TextLabel")
  301. lol.Size = UDim2.new(1.3, 0, 0.4, 0)
  302. lol.TextScaled = true
  303. lol.TextWrapped = true
  304. lol.BackgroundTransparency = 1
  305. lol.Parent = bg
  306. lol.FontSize = "Size24"
  307. lol.TextColor3 = Color3.new(1, 0, 0)
  308. lol.TextStrokeTransparency = 0
  309. lol.Font = "ArialBold"
  310. lol.Text = "-"..damage
  311.  
  312. wait(3)
  313. prt:Destroy()
  314. end)()
  315. end
  316. bulletposition = hitposition
  317. rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
  318. rayPart:Destroy()
  319. break
  320. end
  321. rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
  322. end
  323. end))
  324. end)()
  325. end
  326. wait(0.3)
  327. debounce = false
  328.  
  329. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement