Chungle16

Untitled

Sep 25th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.17 KB | None | 0 0
  1. --madiik's plasma shottie
  2.  
  3. --variables
  4.  
  5. local plr = game:service'Players'.LocalPlayer
  6. local char = plr.Character
  7. local mouse = plr:GetMouse()
  8. local humanoid = char:findFirstChild("Humanoid")
  9. local torso = char:findFirstChild("Torso")
  10. local head = char.Head
  11. local ra = char:findFirstChild("Right Arm")
  12. local la = char:findFirstChild("Left Arm")
  13. local rl = char:findFirstChild("Right Leg")
  14. local ll = char:findFirstChild("Left Leg")
  15. local rs = torso:findFirstChild("Right Shoulder")
  16. local ls = torso:findFirstChild("Left Shoulder")
  17. local rh = torso:findFirstChild("Right Hip")
  18. local lh = torso:findFirstChild("Left Hip")
  19. local neck = torso:findFirstChild("Neck")
  20. local animate = char.Animate
  21.  
  22.  
  23. --some more variables
  24. local equipping = false
  25. local equipped = false
  26. local spread = 0
  27. -- end of some more variables
  28.  
  29. local sound = Instance.new("Sound",head)
  30. sound.SoundId = "http://www.roblox.com/asset?id=130113322"
  31. sound.Volume = 1
  32. sound.Pitch = 1
  33.  
  34. local sound2 = Instance.new("Sound",head)
  35. sound2.SoundId = "http://www.roblox.com/asset?id=130113370"
  36. sound2.Volume = 1
  37. sound2.Pitch = 0.9
  38.  
  39.  
  40. modelName = "Gun"
  41.  
  42. pcall(function()
  43. char:findFirstChild(modelName):Destroy()
  44. end)
  45.  
  46.  
  47. local gun = Instance.new("Model", char)
  48. gun.Name = modelName
  49.  
  50.  
  51.  
  52. function attach(weld, part0, part1)
  53. weld.Part0 = part0
  54. weld.Part1 = part1
  55. end
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65. --create func
  66. function part(parent, size, color, formfactor, collide, transparency)
  67. if transparency == nil then transparency = 0 end
  68. if collide == nil then collide = false end
  69. if formfactor == nil then formfactor = Enum.FormFactor.Custom end
  70. local p=Instance.new("Part", parent)
  71. p.FormFactor=formfactor
  72. p.CanCollide=false
  73. p.Size=size
  74. p.Locked=true
  75. p.Transparency=transparency
  76. p.Position=torso.Position
  77. p.BrickColor=color
  78. p.FrontSurface="SmoothNoOutlines"
  79. p.BackSurface="SmoothNoOutlines"
  80. p.LeftSurface="SmoothNoOutlines"
  81. p.BottomSurface="SmoothNoOutlines"
  82. p.TopSurface="SmoothNoOutlines"
  83. p.RightSurface="SmoothNoOutlines"
  84. return p
  85. end
  86. function wedge(parent, size, color, formfactor, collide, transparency)
  87.  
  88. if transparency == nil then transparency = 0 end
  89. if collide == nil then collide = false end
  90. if formfactor == nil then formfactor = Enum.FormFactor.Custom end
  91.  
  92. local p=Instance.new("WedgePart", parent)
  93. p.FormFactor=formfactor
  94. p.CanCollide=false
  95. p.Size=size
  96. p.Locked=true
  97. p.Position = torso.Position
  98. p.BrickColor=color
  99. p.FrontSurface="SmoothNoOutlines"
  100. p.BackSurface="SmoothNoOutlines"
  101. p.LeftSurface="SmoothNoOutlines"
  102. p.BottomSurface="SmoothNoOutlines"
  103. p.TopSurface="SmoothNoOutlines"
  104. p.RightSurface="SmoothNoOutlines"
  105. return p
  106. end
  107. function weld(part0, part1, c0, parent, c1)
  108. if parent == nil then parent = gun end
  109. if c1 == nil then c1 = CFrame.new() end
  110.  
  111. local wel=Instance.new("Weld", parent)
  112. wel.Part0 = part0
  113. wel.Part1 = part1
  114. wel.C0 = c0
  115. wel.C1 = c1
  116. return wel
  117. end
  118. function specialmesh(parent, meshType, scale, meshId)
  119. local mesh = Instance.new("SpecialMesh", parent)
  120. mesh.Scale = scale
  121. mesh.MeshType = meshType
  122. mesh.MeshId = meshId
  123. return mesh
  124. end
  125.  
  126.  
  127. --some ray functi0n
  128.  
  129. function rayCast(speed, gravity, from)
  130. coroutine.wrap(function()
  131. if char.Humanoid.Health == 0 then return end
  132. local rayP = Instance.new("Part")
  133. rayP.Name = "rayP"
  134. rayP.BrickColor = BrickColor.new("Cyan")
  135. rayP.Anchored = true
  136. rayP.CanCollide = false
  137. rayP.Locked = true
  138. rayP.TopSurface = Enum.SurfaceType.Smooth
  139. rayP.BottomSurface = Enum.SurfaceType.Smooth
  140. rayP.formFactor = Enum.FormFactor.Custom
  141. rayP.Size = Vector3.new(0.2, 0.2, 0.2)
  142.  
  143. Instance.new("PointLight", rayP).Color = Color3.new(0, 255, 255)
  144.  
  145. Instance.new("BlockMesh", rayP).Scale = Vector3.new(0.3, 0.3, 20)
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154. local bulletposition = from.Position + Vector3.new(0, 0.3, 0)
  155.  
  156. local bulletvelocity = (Vector3.new(math.random(-spread*4,spread*4), math.random(-spread*4,spread*4), math.random(-spread*4,spread*4)))+( plr:GetMouse().Hit.p - bulletposition).unit*speed
  157. local bulletlastposition = bulletposition
  158.  
  159.  
  160.  
  161.  
  162. coroutine.resume(coroutine.create(function()
  163. while true do
  164. local dt = wait()
  165. bulletlastposition = bulletposition
  166. bulletvelocity = bulletvelocity + (Vector3.new(0, -9.81*gravity, 0)*dt)
  167. bulletposition = bulletposition + (bulletvelocity*dt)
  168.  
  169. local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition))
  170.  
  171. local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayP, TrailPart} )
  172.  
  173. if (torso.Position - rayP.Position).magnitude > 540 then
  174. rayP:Destroy()
  175. break
  176. end
  177.  
  178.  
  179. if hit then
  180. local damage = math.random(14, 17)
  181. if hit.Parent:findFirstChild("Humanoid") ~= nil then
  182. hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage
  183. end
  184. if hit.Parent:IsA("Hat") and hit.Parent.Parent:findFirstChild("Humanoid") ~= nil then
  185. hit.Parent.Parent.Humanoid.Health = hit.Parent.Parent.Humanoid.Health - damage
  186. end
  187. bulletposition = hitposition
  188. rayP.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
  189. rayP:Destroy()
  190. break
  191. end
  192. rayP.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity)
  193. rayP.Parent = workspace
  194. end
  195. end))
  196. end)()
  197. end
  198.  
  199.  
  200.  
  201. --part(parent, size, color, formfactor(opt), collide(opt), transparency(opt))
  202. --specialmesh(parent, meshType, scale, meshId)
  203. p1 = part(gun, Vector3.new(0.2, 0.85, 1), BrickColor.new("Cyan"))
  204. w1 = weld(p1, torso, CFrame.new(0.6, 0, -1)* CFrame.Angles(-math.pi/4, -math.pi/2, 0))
  205.  
  206.  
  207. p2 = wedge(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.new("Cyan"))
  208. w2 = weld(p2, p1, CFrame.new(0, -0.325, 0.6))
  209.  
  210.  
  211. p3 = wedge(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.new("Cyan"))
  212. w3 = weld(p3, p1, CFrame.new(0, -0.325, 0.6)*CFrame.Angles(math.pi, math.pi, 0))
  213.  
  214.  
  215. p4 = part(gun, Vector3.new(0.2, 0.45, 2), BrickColor.new("Dark stone grey"))
  216. w4 = weld(p4, p1, CFrame.new(0, 0, 1.5))
  217.  
  218.  
  219. p5 = part(gun, Vector3.new(0.2, 0.2, 1), BrickColor.new("Dark stone grey"))
  220. Instance.new("BlockMesh", p5).Scale = Vector3.new(1.01, 0.5, 1.01)
  221. w5 = weld(p5, p1, CFrame.new(0, 0.175, 0))
  222.  
  223.  
  224.  
  225.  
  226. p6 = part(gun, Vector3.new(0.2, 0.2, 1), BrickColor.new("Dark stone grey"))
  227. Instance.new("BlockMesh", p6).Scale = Vector3.new(1.01, 0.5, 1.01)
  228. w6 = weld(p6, p1, CFrame.new(0, -0.175, 0))
  229.  
  230.  
  231.  
  232. p7 = part(gun, Vector3.new(0.2, 0.75, 0.25), BrickColor.new("Cyan"))
  233. Instance.new("BlockMesh", p7).Scale = Vector3.new(.9, 1, 1)
  234. w7 = weld(p7, p1, CFrame.new(0, -0.2, 1)*CFrame.Angles(math.pi/6, 0, 0))
  235.  
  236.  
  237.  
  238. p8 = part(gun, Vector3.new(0.2, 1, 0.2), BrickColor.new("Dark stone grey"))
  239. Instance.new("CylinderMesh", p8)
  240. w8 = weld(p8, p1, CFrame.new(0, -3, -0.1)*CFrame.Angles(math.pi/2, 0, 0))
  241.  
  242.  
  243.  
  244. --part(parent, size, color, formfactor(opt), collide(opt), transparency(opt))
  245. --specialmesh(parent, meshType, scale, meshId)
  246.  
  247.  
  248.  
  249. p9 = part(gun, Vector3.new(0.2, 1, 0.2), BrickColor.new("Dark stone grey"))
  250. Instance.new("CylinderMesh", p9).Scale = Vector3.new(0.8, 1, 0.8)
  251. w9 = weld(p9, p1, CFrame.new(0, -2.8, 0.08)*CFrame.Angles(math.pi/2, 0, 0))
  252.  
  253.  
  254.  
  255.  
  256. pa1 = part(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.new("Dark stone grey"))
  257. specialmesh(pa1, "FileMesh", Vector3.new(0.4, 0.4, 1), "http://www.roblox.com/asset/?id=3270017")
  258. we1 = weld(pa1, p1, CFrame.new(1.1, 0.2, 0)*CFrame.Angles(0, math.pi/2, 0))
  259.  
  260.  
  261. pa2 = part(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.new("Dark stone grey"))
  262. specialmesh(pa2, "FileMesh", Vector3.new(0.35, 0.35, 1.5), "http://www.roblox.com/asset/?id=3270017")
  263. we2 = weld(pa2, p1, CFrame.new(1.9 - 0.6, 0, 0.05)*CFrame.Angles(0, math.pi/2, 0))
  264.  
  265. pa3 = part(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.White())
  266. Instance.new("BlockMesh", pa3).Scale = Vector3.new(0.95, 1, 0.1)
  267. we3 = weld(pa3, p1, CFrame.new(-0.01, 0, 1.82 - 0.6))
  268.  
  269. pa4 = part(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.White())
  270. Instance.new("BlockMesh", pa4).Scale = Vector3.new(0.95, 1, 0.1)
  271. we4 = weld(pa4, p1, CFrame.new(-0.01, 0, 1.98 - 0.6))
  272.  
  273. pa5 = part(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.White())
  274. Instance.new("BlockMesh", pa5).Scale = Vector3.new(0.95, 0.1, 0.1)
  275. we5 = weld(pa5, p1, CFrame.new(-0.01, -0.05, 1.85 - 0.6))
  276.  
  277. pa6 = part(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.White())
  278. Instance.new("BlockMesh", pa6).Scale = Vector3.new(0.95, 0.1, 0.1)
  279. we6 = weld(pa6, p1, CFrame.new(-0.01, -0.05, 1.95 - 0.6))
  280.  
  281. pa7 = part(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.White())
  282. Instance.new("BlockMesh", pa7).Scale = Vector3.new(0.95, 0.1, 0.1)
  283. we7 = weld(pa7, p1, CFrame.new(-0.01, -0.02, 1.9 - 0.6))
  284.  
  285.  
  286. pa8 = wedge(gun, Vector3.new(0.2, 0.2, 0.2), BrickColor.new("Dark stone grey"))
  287. specialmesh(pa8, "Wedge", Vector3.new(0.2, 1, 1), "")
  288. we8 = weld(pa8, p1, CFrame.new(0, -0.23, -3.35)*CFrame.Angles(0, math.pi, 0))
  289.  
  290. pa9 = part(gun, Vector3.new(0.21, 0.8, 0.21), BrickColor.new("Cyan"))
  291. we9 = weld(pa9, p1, CFrame.new(0, -2.3, 0.2)*CFrame.Angles(math.pi/2, 0, 0))
  292.  
  293.  
  294. --part(parent, size, color, formfactor(opt), collide(opt), transparency(opt))
  295. --specialmesh(parent, meshType, scale, meshId)
  296.  
  297.  
  298. for pos = 0.9, 1.9, 0.2 do
  299. local lpart = part(gun, Vector3.new(0.201, 0.201, 0.201), BrickColor.new("Cyan"))
  300. Instance.new("BlockMesh", lpart).Scale = Vector3.new(1, 0.5, 0.8)
  301. local lweld = weld(lpart, p1, CFrame.new(0, -0.25, pos))
  302. end
  303.  
  304.  
  305.  
  306. --function attach(weld, part0, part1)
  307. --weld.Part0 = part0
  308. --weld.Part1 = part1
  309. --end
  310.  
  311. function equip()
  312. animate.Disabled = true
  313. --weld(part0, part1, c0, c1)
  314. --part(parent, size, color, formfactor(opt), collide(opt), transparency(opt))
  315. local ftorso = part(gun, torso.Size, torso.BrickColor)
  316. ftorso.Name = "FakeTorsoShotgun"
  317. Instance.new("SpecialMesh", ftorso).MeshId = "rbxasset://fonts/torso.mesh"
  318. local ftorsoweld = weld(ftorso, torso, CFrame.new(),ftorso)
  319. torso.Transparency = 1
  320. local ar = Instance.new("Part", gun)
  321. ar.FormFactor = "Custom"
  322. ar.Size = Vector3.new(1, 1, 1)
  323. ar.Transparency = 1
  324. ar.CanCollide = false
  325. ar.Locked = true
  326. ar.Name = "ShoulderJoint"
  327. ar:BreakJoints()
  328. local weldf = Instance.new("Motor", ar)
  329. weldf.C0 = CFrame.new(0, 0.5, 0)
  330. weldf.Part0 = ra
  331. weldf.Part1 = ar
  332. motor = Instance.new("Motor", ar)
  333. motor.Part0 = ftorso
  334. motor.Part1 = ar
  335. motor.C0 = CFrame.new(1.5, 0.5, 0)
  336. local ar2 = Instance.new("Part", gun)
  337. ar2.FormFactor = "Custom"
  338. ar2.Size = Vector3.new(1, 1, 1)
  339. ar2.Transparency = 1
  340. ar2.CanCollide = false
  341. ar2.Locked = true
  342. ar2.Name = "ShoulderJoint2"
  343. ar2:BreakJoints()
  344. local weldf2 = Instance.new("Motor", ar2)
  345. weldf2.C0 = CFrame.new(0, 0.5, 0)
  346. weldf2.Part0 = la
  347. weldf2.Part1 = ar2
  348. motor2 = Instance.new("Motor", ar2)
  349. motor2.Part0 = ftorso
  350. motor2.Part1 = ar2
  351. motor2.C0 = CFrame.new(-1.5, 0.5, 0)
  352. w1.Part1 = ra
  353. for angle = 0, 180, 20 do
  354. w1.C0 = CFrame.new(0+angle/460, 0.5-angle/160, 0.5-angle/360) * CFrame.Angles(math.pi + math.rad(angle/2), math.rad(angle), math.rad(angle))
  355. wait()
  356. end
  357. attach(rh, ftorso, rl)
  358. attach(lh, ftorso, ll)
  359. for angle = 0, 90, 10 do
  360. ftorsoweld.C0 = CFrame.new() * CFrame.Angles(0, math.rad(angle-30), 0)
  361. motor.C0 = CFrame.new(1.3, 0.5, 0-angle/120) * CFrame.Angles(math.rad(angle), 0, -math.rad(angle-30))
  362. motor2.C0 = CFrame.new(-1.3, 0.5, 0-angle/180) * CFrame.Angles(math.rad(angle), 0, 0)
  363. wait()
  364. end
  365.  
  366.  
  367.  
  368.  
  369. end
  370.  
  371. function unequip()
  372. animate.Disabled = false
  373. attach(rh, torso, rl)
  374. attach(lh, torso, ll)
  375. w1.C0 = CFrame.new(0.6, 0, -1)* CFrame.Angles(-math.pi/4, -math.pi/2, 0)
  376. w1.Part1 = torso
  377. torso.Transparency = 0
  378. pcall(function()
  379. gun.FakeTorsoShotgun:Destroy()
  380. gun.FakeTorsoShotgun:Destroy()
  381. gun.ShoulderJoint:Destroy()
  382. gun.ShoulderJoint:Destroy()
  383. gun.ShoulderJoint2:Destroy()
  384. gun.ShoulderJoint2:Destroy()
  385. end)
  386.  
  387. end
  388.  
  389.  
  390. local tool = Instance.new("HopperBin", plr.Backpack)
  391. tool.Name = "Plasma Shotgun"
  392.  
  393.  
  394.  
  395. tool.Selected:connect(function(mouse2)
  396. equipped = true
  397. local mainGui = Instance.new("ScreenGui", plr.PlayerGui)
  398. mainGui.Name = "AccuracyStuff"
  399.  
  400. local accuracyFrame = Instance.new("Frame", mainGui)
  401. accuracyFrame.Size = UDim2.new(0, 100, 0, 100)
  402. accuracyFrame.BackgroundTransparency = 1
  403.  
  404. mouse2.Icon = "http://www.roblox.com/asset/?id=108625356"
  405.  
  406.  
  407.  
  408. local accuracy1 = Instance.new("TextLabel", accuracyFrame)
  409. accuracy1.Text = ""
  410. accuracy1.BorderSizePixel = 0
  411. accuracy1.BackgroundColor = BrickColor.new("Lime green")
  412. accuracy1.Size = UDim2.new(0, -15, 0, 2)
  413.  
  414. local accuracy2 = Instance.new("TextLabel", accuracyFrame)
  415. accuracy2.Text = ""
  416. accuracy2.BorderSizePixel = 0
  417. accuracy2.BackgroundColor = BrickColor.new("Lime green")
  418. accuracy2.Size = UDim2.new(0, 15, 0, 2)
  419.  
  420. local accuracy3 = Instance.new("TextLabel", accuracyFrame)
  421. accuracy3.Text = ""
  422. accuracy3.BorderSizePixel = 0
  423. accuracy3.BackgroundColor = BrickColor.new("Lime green")
  424. accuracy3.Size = UDim2.new(0, 2, 0, -15)
  425.  
  426. local accuracy4 = Instance.new("TextLabel", accuracyFrame)
  427. accuracy4.Text = ""
  428. accuracy4.BorderSizePixel = 0
  429. accuracy4.BackgroundColor = BrickColor.new("Lime green")
  430. accuracy4.Size = UDim2.new(0, 2, 0, 15)
  431.  
  432. coroutine.wrap(function()
  433. while equipped do
  434. if spread < 0 then spread = 0 end
  435. if humanoid.Health == 0 then break end
  436. accuracy1.Position = UDim2.new(0, 41-(spread*40), 0, 50)
  437. accuracy2.Position = UDim2.new(0, 60+(spread*40), 0, 50)
  438. accuracy3.Position = UDim2.new(0, 50, 0, 40-(spread*40))
  439. accuracy4.Position = UDim2.new(0, 50, 0, 60+(spread*40))
  440. accuracyFrame.Position = UDim2.new(0, mouse.X-50, 0, mouse.Y-50)
  441. game:service'RunService'.Stepped:wait()
  442. end
  443. end)()
  444.  
  445. equip()
  446. mouse2.Button1Down:connect(function()
  447. if debounce then return end
  448. debounce = true
  449. sound:play()
  450. motor.C0 = motor.C0 * CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(20), -math.rad(12), 0)
  451. coroutine.wrap(function()
  452. wait(0.3)
  453. for angle = 0, 4 do
  454. motor.C0 = motor.C0 * CFrame.Angles(-math.rad(3.5), math.rad(2.2), 0)
  455. wait()
  456. end
  457. motor.C0 = CFrame.new(1.3, 0.5, 0-90/120) * CFrame.Angles(math.rad(90), 0, -math.rad(90-30))
  458. wait(0.2)
  459. sound2:play()
  460. we9.C0 = we9.C0 * CFrame.new(0, 0, -0.3)
  461. motor2.C0 = motor2.C0 * CFrame.new(0.3, 0, 0)
  462. wait(0.1)
  463. for move = 0, 3 do
  464. if move > 2 then return end
  465. we9.C0 = we9.C0 * CFrame.new(0, 0, 0.1)
  466. motor2.C0 = motor2.C0 * CFrame.new(-0.1, 0, 0)
  467. wait(0.06)
  468. end
  469. end)()
  470. spread = spread + 1
  471. coroutine.wrap(function()
  472. for bullitz = 0, 7 do
  473. if bullitz > 6 then return end
  474. rayCast(200, 2, pa8)
  475. end
  476. end)()
  477. coroutine.wrap(function()
  478. for _ = 0, 50 do
  479. pcall(function()
  480. spread = spread - 0.02
  481. end)
  482. wait()
  483. end
  484. end)()
  485. wait(1)
  486. debounce = false
  487. end)
  488.  
  489. end)
  490.  
  491. tool.Deselected:connect(function()
  492. equipped = false
  493. pcall(function()
  494. unequip()
  495. plr.PlayerGui.AccuracyStuff:Destroy()
  496. plr.PlayerGui.AccuracyStuff:Destroy()
  497. plr.PlayerGui.AccuracyStuff:Destroy()
  498. end)
  499. end)
Add Comment
Please, Sign In to add comment