Advertisement
mooodi1234

Minigun Face

Jun 11th, 2017
377
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.49 KB | None | 0 0
  1. local pjts = {}
  2.  
  3. function FireProjectile(origin, velocity, raycallback, ignore, draw)
  4. table.insert(pjts,{origin, origin, velocity, raycallback, ignore, draw})
  5. end
  6.  
  7. local player = game:GetService("Players").LocalPlayer
  8. local mouse = player:GetMouse()
  9. local mousedown = false
  10. local downtime = 0
  11. local spin = false
  12. local selected = false
  13. local swagbullets = 200
  14. local neck = player.Character.Torso.Neck
  15. local neckc0 = neck.C0
  16.  
  17. local bin = Instance.new("HopperBin", player.Backpack)
  18. bin.Name = "Machine Face"
  19.  
  20. local staspin = Instance.new("Sound", player.Character.Head)
  21. staspin.SoundId = "http://roblox.com/asset/?id=10209788"
  22.  
  23. local stospin = Instance.new("Sound", player.Character.Head)
  24. stospin.SoundId = "http://roblox.com/asset/?id=10209786"
  25.  
  26. local sping = Instance.new("Sound", player.Character.Head)
  27. sping.SoundId = "http://roblox.com/asset/?id=10209780"
  28. sping.Looped = true
  29.  
  30. local bang = Instance.new("Sound", player.Character.Head)
  31. bang.SoundId = "http://roblox.com/asset/?id=10209776"
  32. bang.Looped = true
  33.  
  34. local clicking = Instance.new("Sound", player.Character.Head)
  35. clicking.SoundId = "http://roblox.com/asset/?id=10209771"
  36. clicking.Looped = true
  37.  
  38. local face = nil
  39.  
  40. if player.Character.Head:FindFirstChild("face") then
  41. face = player.Character.Head.face:clone()
  42. end
  43.  
  44. local controlpart = Instance.new("Part", player.Character)
  45. controlpart.Anchored = false
  46. controlpart.CanCollide = false
  47. controlpart.TopSurface = 0
  48. controlpart.BottomSurface = 0
  49. controlpart.FormFactor = "Custom"
  50. controlpart.Size = Vector3.new(0,0,0)
  51. controlpart.Transparency = 1
  52.  
  53. local muzzle = Instance.new("Part", player.Character)
  54. muzzle.Anchored = false
  55. muzzle.CanCollide = false
  56. muzzle.TopSurface = 0
  57. muzzle.BottomSurface = 0
  58. muzzle.FormFactor = "Custom"
  59. muzzle.Size = Vector3.new(0,0,0)
  60. muzzle.Transparency = 1
  61.  
  62. local casething = Instance.new("Part", player.Character)
  63. casething.Anchored = false
  64. casething.CanCollide = false
  65. casething.TopSurface = 0
  66. casething.BottomSurface = 0
  67. casething.FormFactor = "Custom"
  68. casething.Size = Vector3.new(0.5,0.3,0.7)
  69. casething.BrickColor = BrickColor.new("Really black")
  70.  
  71. local control = Instance.new("Weld", controlpart)
  72. control.Part0 = player.Character.Head
  73. control.Part1 = controlpart
  74. control.C0 = CFrame.new(0,0,1)
  75.  
  76. local muzweld = Instance.new("Weld", controlpart)
  77. muzweld.Part0 = player.Character.Head
  78. muzweld.Part1 = muzzle
  79. muzweld.C0 = CFrame.new(0,0.2,-1.4)
  80.  
  81. local ctweld = Instance.new("Weld", controlpart)
  82. ctweld.Part0 = player.Character.Head
  83. ctweld.Part1 = casething
  84. ctweld.C0 = CFrame.new(0,0,0.1)
  85.  
  86. local muzflash = Instance.new("PointLight", muzzle)
  87. muzflash.Range = 10
  88. muzflash.Color = Color3.new(1,0.8,0)
  89. muzflash.Enabled = false
  90.  
  91. for i = 0,300,60 do
  92. local mpart = Instance.new("Part", player.Character)
  93. mpart.Anchored = false
  94. mpart.CanCollide = false
  95. mpart.TopSurface = 0
  96. mpart.BottomSurface = 0
  97. mpart.FormFactor = "Custom"
  98. mpart.Size = Vector3.new(0.2,1,0.2)
  99. mpart.BrickColor = BrickColor.new("Black")
  100. Instance.new("CylinderMesh",mpart)
  101. local weld = Instance.new("Weld", mpart)
  102. weld.Part0 = controlpart
  103. weld.Part1 = mpart
  104. weld.C0 = CFrame.new(0,0,-1) * CFrame.Angles(math.rad(90),0,0) * CFrame.Angles(0,math.rad(i),0) * CFrame.new(0,0,0.2)
  105. end
  106.  
  107. local dpart = Instance.new("Part", player.Character)
  108. dpart.Anchored = false
  109. dpart.CanCollide = false
  110. dpart.TopSurface = 0
  111. dpart.BottomSurface = 0
  112. dpart.FormFactor = "Custom"
  113. dpart.Size = Vector3.new(0.7,0.2,0.7)
  114. dpart.BrickColor = BrickColor.new("Black")
  115. Instance.new("CylinderMesh",dpart).Scale = Vector3.new(1,0.6,1)
  116. local dweld = Instance.new("Weld", dpart)
  117. dweld.Part0 = controlpart
  118. dweld.Part1 = dpart
  119. dweld.C0 = CFrame.new(0,0,-0.9) * CFrame.Angles(math.rad(90),0,0)
  120.  
  121. local dpart = Instance.new("Part", player.Character)
  122. dpart.Anchored = false
  123. dpart.CanCollide = false
  124. dpart.TopSurface = 0
  125. dpart.BottomSurface = 0
  126. dpart.FormFactor = "Custom"
  127. dpart.Size = Vector3.new(0.7,0.2,0.7)
  128. dpart.BrickColor = BrickColor.new("Black")
  129. Instance.new("CylinderMesh",dpart).Scale = Vector3.new(1,0.6,1)
  130. local dweld = Instance.new("Weld", dpart)
  131. dweld.Part0 = controlpart
  132. dweld.Part1 = dpart
  133. dweld.C0 = CFrame.new(0,0,-1.3) * CFrame.Angles(math.rad(90),0,0)
  134.  
  135. bin.Selected:connect(function()
  136. local asd = 1
  137. local tcount = 0
  138. if player.Character.Head:FindFirstChild("face") then player.Character.Head.face:Destroy() end
  139. while true do
  140. local dt = wait()
  141. tcount = tcount + dt
  142. asd = 1+math.cos((math.pi/2)+(tcount*4))*1.1
  143. if tcount >= 0.5 then
  144. break
  145. end
  146. control.C0 = CFrame.new(0,0,asd)
  147. end
  148. control.C0 = CFrame.new()
  149. local asd = 0.1
  150. while true do
  151. local dt = wait()
  152. asd = asd + dt
  153. if asd >= 0.3 then
  154. break
  155. end
  156. ctweld.C0 = CFrame.new(0,0,asd)
  157. end
  158. ctweld.C0 = CFrame.new(0,0,0.3)
  159. selected = true
  160. end)
  161. bin.Deselected:connect(function()
  162. selected = false
  163. if spin then
  164. sping:Stop()
  165. staspin:Stop()
  166. bang:Stop()
  167. clicking:Stop()
  168. stospin:Play()
  169. end
  170. spin = false
  171. mousedown = false
  172. local asd = 0.3
  173. while true do
  174. local dt = wait()
  175. asd = asd - dt
  176. if asd <= 0.1 then
  177. break
  178. end
  179. ctweld.C0 = CFrame.new(0,0,asd)
  180. end
  181. ctweld.C0 = CFrame.new(0,0,0.1)
  182. local asd = 0
  183. local tcount = 0
  184. while true do
  185. local dt = wait()
  186. tcount = tcount + dt
  187. asd = 1+math.sin(((tcount-0.1)*4)-(math.pi/2))*1.1
  188. if tcount >= 0.48 then
  189. break
  190. end
  191. control.C0 = CFrame.new(0,0,asd)
  192. end
  193. control.C0 = CFrame.new(0,0,1)
  194. face:clone().Parent = player.Character.Head
  195. end)
  196.  
  197. mouse.KeyDown:connect(function(key)
  198. if key == "q" and selected then
  199. spin = true
  200. staspin:Play()
  201. coroutine.wrap(function()
  202. wait(0.8)
  203. if spin then
  204. staspin:Stop()
  205. sping:Play()
  206. end
  207. end)()
  208. elseif key == "r" and selected then
  209.  
  210. swagbullets = 200
  211. end
  212. end)
  213.  
  214. mouse.KeyUp:connect(function(key)
  215. if key == "q" and selected and spin then
  216. spin = false
  217. mousedown = false
  218. sping:Stop()
  219. staspin:Stop()
  220. bang:Stop()
  221. clicking:Stop()
  222. stospin:Play()
  223. end
  224. end)
  225.  
  226. mouse.Button1Down:connect(function()
  227. if spin then
  228. mousedown = true
  229. bang:Play()
  230. end
  231. end)
  232.  
  233. mouse.Button1Up:connect(function()
  234. mousedown = false
  235. bang:Stop()
  236. clicking:Stop()
  237. end)
  238.  
  239. function gethums(part)
  240. local hums = {}
  241. local function scanparent(asd)
  242. local humscan = {}
  243. for _,v in pairs(asd.Parent:GetChildren()) do
  244. if v:IsA("Humanoid") then
  245. table.insert(humscan,v)
  246. end
  247. end
  248. return asd.Parent, humscan
  249. end
  250. local currentasd = part
  251. while true do
  252. if currentasd.Parent ~= workspace then
  253. local parent, humscan = scanparent(currentasd)
  254. hums = {unpack(hums),unpack(humscan)}
  255. currentasd = parent
  256. else
  257. break
  258. end
  259. end
  260. return hums
  261. end
  262.  
  263. --FireProjectile(player.Character.Head.Position, player.Character.Head.Velocity+mouse.UnitRay.Direction*400, function(self,...) return false end, {player.Character})
  264.  
  265. while true do
  266. local dt = wait()
  267. local ax,ay,az = player.Character.Torso.CFrame:toEulerAnglesXYZ()
  268. local cx,cy,cz = CFrame.new(Vector3.new(),mouse.UnitRay.Direction):toEulerAnglesXYZ()
  269. neck.C0 = CFrame.new(0,1,0)*(CFrame.Angles(ax,ay,az):inverse())*CFrame.Angles(cx,cy,cz)*CFrame.Angles(-math.pi/2,0,math.pi)
  270. if spin then
  271. control.C0 = control.C0 * CFrame.Angles(0,0,10*dt)
  272. end
  273. if mousedown and spin then
  274. downtime = downtime + dt
  275. else
  276. downtime = 0
  277. end
  278. if downtime >= 0.05 then
  279. muzflash.Enabled = true
  280. for i = 0.05, downtime, 0.05 do
  281. if swagbullets > 0 then
  282. downtime = downtime - 0.05
  283. swagbullets = swagbullets - 1
  284. FireProjectile((muzzle.CFrame).p, player.Character.Head.Velocity+((Vector3.new(math.random()-0.5,math.random()-0.5,math.random()-0.5)*0.05)+mouse.UnitRay.Direction)*250, function(self,opart)
  285. local humans = gethums(opart)
  286. for _,hum in pairs(humans) do
  287. hum:TakeDamage(5)
  288. end
  289. return false
  290. end, {player.Character}, function(p1,p2)
  291. asdpart = Instance.new("Part")
  292. asdpart.Anchored = true
  293. asdpart.CanCollide = false
  294. asdpart.TopSurface = 0
  295. asdpart.BottomSurface = 0
  296. asdpart.FormFactor = "Custom"
  297. asdpart.Size = Vector3.new(1,1,1)
  298. asdpart.BrickColor = BrickColor.new("Bright yellow")
  299. asdpart.Reflectance = 0.5
  300. asdpart.CFrame = CFrame.new(p1:Lerp(p2,0.5),p2)+Vector3.new(100,100,0)
  301. local asdmesh = Instance.new("BlockMesh",asdpart)
  302. asdmesh.Scale = Vector3.new(0.1,0.1,(p1-p2).magnitude)
  303. asdmesh.Offset = ((asdpart.CFrame - asdpart.CFrame.p):inverse() * CFrame.new(-100,-100,0)).p
  304. asdpart.Parent = workspace
  305. coroutine.wrap(function()
  306. local noobfacepartlol = asdpart
  307. wait()
  308. if noobfacepartlol then noobfacepartlol:Destroy() end
  309. end)()
  310. return asdpart
  311. end)
  312. else
  313. if not clicking.IsPlaying then
  314. clicking:Play()
  315. bang:Stop()
  316. end
  317. end
  318. end
  319. coroutine.wrap(function()
  320. if swagbullets <= 0 then
  321. muzflash.Enabled = false
  322. end
  323. wait()
  324. if swagbullets > 0 then
  325. muzflash.Enabled = false
  326. local scr = Instance.new("BillboardGui", muzzle)
  327. scr.Adornee = muzzle
  328. scr.Size = UDim2.new(2, 0, 2, 0)
  329. scr.StudsOffset = Vector3.new(0,0,0.2)
  330. scr.Name = "flash"
  331. local pic = Instance.new("ImageLabel", scr)
  332. pic.Image = "http://www.roblox.com/asset/?id=62701218"
  333. pic.Size = UDim2.new(1, 0, 1, 0)
  334. pic.BorderSizePixel = 0
  335. pic.BackgroundTransparency = 1
  336. game:GetService("Debris"):AddItem(scr,0.1)
  337. local case = Instance.new("Part", player.Character)
  338. case.Name = "BulletShell"
  339. case.Anchored = false
  340. case.CanCollide = true
  341. case.TopSurface = "Smooth"
  342. case.BottomSurface = "Smooth"
  343. case.FormFactor = "Custom"
  344. case.Size = Vector3.new(0.2, 0.4, 0.2)
  345. case.Elasticity = 0
  346. case.Reflectance = 0.1
  347. case.BrickColor = BrickColor.new("Bright yellow")
  348. case.CFrame = player.Character.Head.CFrame * CFrame.new(0,0,0.9) * CFrame.Angles(0,0,math.pi/2)
  349. case.Velocity = Vector3.new(0,11,0)-mouse.UnitRay.Direction*7
  350. local casemesh = Instance.new("CylinderMesh", case)
  351. casemesh.Scale = Vector3.new(0.7, 0.7, 0.7)
  352. game:GetService("Debris"):AddItem(case,0.6)
  353. ctweld.C0 = CFrame.new(0,0,0.7)
  354. wait()
  355. ctweld.C0 = CFrame.new(0,0,0.3)
  356. end
  357. end)()
  358. end
  359. for i,pjt in pairs(pjts) do
  360. pjt[2] = pjt[1]
  361. pjt[1] = pjt[1] + pjt[3]*dt
  362. pjt[3] = pjt[3] - Vector3.new(0,196.2,0)*dt
  363. local pjtray = Ray.new(pjt[2],pjt[1]-pjt[2])
  364. local pjtig = {unpack(pjt[5]),pjt[7]}
  365. for _,opjt in pairs(pjts) do
  366. if opjt[7] then
  367. table.insert(pjtig,opjt[7])
  368. end
  369. end
  370. local hpart, hpos = workspace:FindPartOnRayWithIgnoreList(pjtray, pjtig, false)
  371. if hpart and hpos then
  372. local stillgoes = pjt[4](pjt,hpart,hpos,pjt[3])
  373. if stillgoes then
  374. hpos = pjt[1]
  375. else
  376. pjts[i] = nil
  377. end
  378. end
  379. if pjt[6] then
  380. pjt[7] = pjt[6](pjt[2],hpos)
  381. else
  382. pjt[7] = Instance.new("Part")
  383. pjt[7].Anchored = true
  384. pjt[7].CanCollide = false
  385. pjt[7].TopSurface = 0
  386. pjt[7].BottomSurface = 0
  387. pjt[7].FormFactor = "Custom"
  388. pjt[7].Size = Vector3.new(1,1,1)
  389. pjt[7].CFrame = CFrame.new(pjt[2]:Lerp(hpos,0.5),hpos)+Vector3.new(100,100,0)
  390. local asdmesh = Instance.new("BlockMesh",pjt[7])
  391. asdmesh.Scale = Vector3.new(0.2,0.2,(pjt[2]-hpos).magnitude)
  392. asdmesh.Offset = ((pjt[7].CFrame - pjt[7].CFrame.p):inverse() * CFrame.new(-100,-100,0)).p
  393. pjt[7].Parent = workspace
  394. coroutine.wrap(function()
  395. local noobfacepartlol = pjt[7]
  396. wait()
  397. if noobfacepartlol then noobfacepartlol:Destroy() end
  398. end)()
  399. end
  400. if pjt[1].y < -300 then
  401. pjts[i] = nil
  402. end
  403. end
  404. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement