xXjoethebestXx

Script

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