Advertisement
deezfai

Untitled

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