iiWolfie

roblox plasma gun

May 24th, 2016
695
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local Player = game:service("Players").LocalPlayer
  2. local asset = "http://www.roblox.com/asset/?id="
  3. Stats = {
  4. Energy = 60,
  5. MaxEnergy = 120,
  6. Rage = 120,
  7. MaxRage = 120,
  8. }
  9. pcall(function() Player.Character.WeaponBase:remove() end)
  10. local Model = Instance.new("Model",Player.Character)
  11. Model.Name = "WeaponBase"
  12. local Char = Player.Character
  13. local Larm = Char["Left Arm"]
  14. local Rarm = Char["Right Arm"]
  15. local Lleg = Char["Left Leg"]
  16. local Rleg = Char["Right Leg"]
  17. local Torso = Char.Torso
  18. local Head = Char.Head
  19. local Activ = false
  20. local select = false
  21. local Sit = false
  22. local Spack = false
  23. function Part(Name, Parent, Func)
  24. local P = Instance.new("Part",Parent)
  25. P.Name = Name
  26. P.CanCollide = false
  27. P.Locked = true
  28. if Func ~= nil then
  29. Func(P)
  30. end
  31. return P
  32. end
  33. function NewI(Name,Parent,Instanc,Func)
  34. local I = Instance.new(Instanc,Parent)
  35. I.Name = Name
  36. if Func ~= nil then
  37. Func(I)
  38. end
  39. return I
  40. end
  41. function Gui(Name,Type,Parent,Func)
  42. local G = Instance.new(Type,Parent)
  43. G.Name = Name
  44. if Func ~= nil then
  45. Func(G)
  46. end
  47. return G
  48. end
  49. --Arm welds
  50. local RP = Part("RarmP",Model,function(v) v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.2) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part1 = v Weld.Part0 = Torso Weld.C1 = CFrame.new(-1.5,-0.5,0) v.Transparency = 0 end)
  51. local LP = Part("LarmP",Model,function(v) v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.2) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part1 = v Weld.Part0 = Torso Weld.C1 = CFrame.new(1.5,-0.5,0) v.Transparency = 0 end)
  52. local RlP = Part("RlegP",Model,function(v) v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.2) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part1 = v Weld.Part0 = Torso Weld.C1 = CFrame.new(-0.5,1.5,0) v.Transparency = 0 end)
  53. local LlP = Part("LlegP",Model,function(v) v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.2) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part1 = v Weld.Part0 = Torso Weld.C1 = CFrame.new(0.5,1.5,0) v.Transparency = 0 end)
  54. local HP = Part("HeadP",Model,function(v) v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.2) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part1 = v Weld.Part0 = Torso Weld.C1 = CFrame.new(0,-1,0) v.Transparency = 0 end)
  55. local RW = NewI("RarmW",RP,"Weld",function(v) v.Part1 = RP v.Part0 = nil v.C0 = CFrame.new(0,0.5,0) end)
  56. local LW = NewI("LarmW",LP,"Weld",function(v) v.Part1 = LP v.Part0 = nil v.C0 = CFrame.new(0,0.5,0) end)
  57. local RlW = NewI("RlegW",RlP,"Weld",function(v) v.Part1 = RlP v.Part0 = nil v.C0 = CFrame.new(0,0.5,0) end)
  58. local LlW = NewI("LlegW",LlP,"Weld",function(v) v.Part1 = LlP v.Part0 = nil v.C0 = CFrame.new(0,0.5,0) end)
  59. local HW = NewI("HeadW",HP,"Weld",function(v) v.Part1 = HP v.Part0 = Head v.C0 = CFrame.new(0,-0.5,0) end)
  60. local TG = Instance.new("BodyGyro")
  61. TG.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  62. --Prop
  63. local HP = Part("HandleP",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = Rarm Weld.C1 = CFrame.new(0,-1,0)*CFrame.Angles(math.rad(90),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,7.5,1) end)
  64. local HP2 = Part("Handle2",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,7.5,1) end)
  65. local HP3 = Part("HandleP3",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP Weld.C1 = CFrame.new(0,-0.75,0)*CFrame.Angles(math.rad(90),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,5,1) end)
  66. local HP4 = Part("Handle4",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP3 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,5,1) end)
  67. local HP5 = Part("HandleP5",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP3 Weld.C1 = CFrame.new(0,-0.75,-0.055)*CFrame.Angles(math.rad(11.25),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,3,1) end)
  68. local HP6 = Part("Handle6",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP5 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,3,1) end)
  69. local HP7 = Part("HandleP7",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP5 Weld.C1 = CFrame.new(0,-0.75/1.325,-0.055)*CFrame.Angles(math.rad(11.25),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,3,1) end)
  70. local HP8 = Part("Handle8",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP7 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,3,1) end)
  71. local HP9 = Part("HandleP9",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP Weld.C1 = CFrame.new(0,0.75,0)*CFrame.Angles(math.rad(90),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,5,1) end)
  72. local HP10 = Part("Handle10",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP9 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,5,1) end)
  73. local HP11 = Part("HandleP11",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP9 Weld.C1 = CFrame.new(0,-0.75,0.055)*CFrame.Angles(math.rad(-11.25),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,3,1) end)
  74. local HP12 = Part("Handle12",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP11 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,3,1) end)
  75. local HP13 = Part("HandleP13",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP11 Weld.C1 = CFrame.new(0,-0.75/1.325,0.055)*CFrame.Angles(math.rad(-11.25),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,3,1) end)
  76. local HP14 = Part("Handle14",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP13 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,3,1) end)
  77. local HP15 = Part("HandleP13",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP3 Weld.C1 = CFrame.new(0,0.65,-0.2)*CFrame.Angles(math.rad(-45),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,3.301,1) end)
  78. local HP16 = Part("Handle14",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP15 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,3.3,1) end)
  79. local HP17 = Part("HandleP17",Model,function(v) v.BrickColor = BrickColor.new("Black") v.formFactor = "Custom" v.Size = Vector3.new(0.25,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP9 Weld.C1 = CFrame.new(0,0.65,0.2)*CFrame.Angles(math.rad(45),0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,3.301,1) end)
  80. local HP18 = Part("Handle18",Model,function(v) v.BrickColor = BrickColor.new("Medium stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.25) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP17 Weld.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(1,3.3,1) end)
  81. local HP19 = Part("HandleP19",Model,function(v) v.BrickColor = BrickColor.new("Dark stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.2) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP17 Weld.C1 = CFrame.new(0,0.325,0)*CFrame.Angles(0,0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,0.1,1) end)
  82. local HP20 = Part("HandleP20",Model,function(v) v.BrickColor = BrickColor.new("Dark stone grey") v.formFactor = "Custom" v.Size = Vector3.new(0.2,0.2,0.2) v:BreakJoints() local Weld = Instance.new("Weld",v) Weld.Part0 = v Weld.Part1 = HP15 Weld.C1 = CFrame.new(0,0.325,0)*CFrame.Angles(0,0,0) local m = Instance.new("CylinderMesh",v) m.Scale = Vector3.new(1,0.1,1) end)
  83. --
  84. function trail(lastp,p,parent)
  85. local trl = Part("trail",parent,function(v) v.Transparency = 0.5 v.BrickColor = BrickColor.new("Medium blue") v.formFactor = "Custom" v.Size = Vector3.new(1.5,(p-lastp).magnitude,1.5) local m = Instance.new("CylinderMesh",v) v.Anchored = true v.CFrame = CFrame.new((p + lastp)/2,lastp)*CFrame.Angles(math.rad(90),0,0) end)
  86. coroutine.wrap(function()
  87. for i = 0, 1, 0.15 do
  88. trl.Mesh.Scale = trl.Mesh.Scale - Vector3.new(0.075,0,0.075)
  89. wait(0.03)
  90. end
  91. trl:remove()
  92. end)()
  93. return p
  94. end
  95. function efct()
  96. pcall(function() Model.EFCT:remove() end)
  97. local efc = NewI("EFCT",Model,"Model")
  98. local pos1 = HP19.Position
  99. local pos2 = Vector3.new(math.random(-0.45, 0.45),math.random(-0.45, 0.45),math.random(-0.45, 0.45))+(CFrame.new(pos1+((HP20.Position-pos1)))).p
  100. local efc1 = Part("efc1",efc,function(v) v.Transparency = 0.5 v.BrickColor = BrickColor.new("Medium blue") v.formFactor = "Custom" v.Size = Vector3.new(1,1,1) local m = Instance.new("BlockMesh",v) m.Scale = Vector3.new(0.025, 0.025, (pos1 - pos2).magnitude) v.Anchored = true v.CFrame = CFrame.new((pos1 + pos2) / 2, pos2) end)
  101. coroutine.wrap(function()
  102. wait(.15)
  103. efc:remove()
  104. end)()
  105. end
  106. function showdmg(targ,dmg)
  107. local ml = Instance.new("Model",Model)
  108. ml.Name = "-"..dmg
  109. local lbl = Part("Head",ml,function(v) v.BrickColor = BrickColor.new("Bright red") v.formFactor = "Custom" v.Transparency = 0 v.Size = Vector3.new(0.3,0.3,0.3) v.Anchored = true v.CFrame = targ.Torso.CFrame*CFrame.new(math.rad(-1,1),math.rad(-1,1),math.rad(-1,1)) local m = Instance.new("SpecialMesh",v) m.MeshType = "Sphere"end)
  110. local H = Instance.new("Humanoid",ml)
  111. H.MaxHealth = 0
  112. H.Health = 0
  113. coroutine.resume(coroutine.create(function()
  114. for i = 1, 30 do
  115. lbl.CFrame = lbl.CFrame*CFrame.new(0,0.25,0)
  116. wait()
  117. end
  118. ml:remove()
  119. end))
  120. end
  121. function ray(pos,dcnt)
  122. local efc = NewI("Shot",game:service("Workspace"),"Model")
  123. local shot = Part("shot",efc,function(v) v.Transparency = 0.5 v.BrickColor = BrickColor.new("Medium blue") v.formFactor = "Custom" v.Size = Vector3.new(1,1,1) local m = Instance.new("SpecialMesh",v) m.MeshType = "Sphere" m.Scale = Vector3.new(2, 2, 2) v.Anchored = true v.CFrame = HP19.CFrame*CFrame.new(0,0.25,0) end)
  124. shot.CFrame = CFrame.new(shot.Position,pos)
  125. local lst = shot.Position
  126. coroutine.wrap(function()
  127. while efc.Parent ~= nil do
  128. for _,v in pairs(game:service("Workspace"):children()) do
  129. if v:findFirstChild("Humanoid") ~= nil and v:findFirstChild("Torso") ~= nil then
  130. if (v.Torso.Position - shot.Position).magnitude <= 1.5 then
  131. local dmg = math.random(100,250)
  132. v.Humanoid.Health = v.Humanoid.Health - dmg
  133. showdmg(v,dmg)
  134. efc:remove()
  135. end
  136. end
  137. if v.Name == "Shot" then
  138. local Ran,Error = coroutine.resume(coroutine.create(function()
  139. if v~=efc then
  140. if (v.shot.Position - shot.Position).magnitude <= 2 then
  141. v:remove()
  142. efc:remove()
  143. local shck = Part("shckwave",efc,function(v) v.Transparency = 0.75 v.BrickColor = BrickColor.new("Medium blue") v.formFactor = "Custom" v.Size = Vector3.new(1,0.2,1) local m = Instance.new("BlockMesh",v) m.Name = "Mesh" m.Scale = Vector3.new(2, 0.5, 2) v.Anchored = true v.CFrame = CFrame.new(shot.Position.X, Torso.Position.Y, shot.Position.Z) end)
  144. local d = Instance.new("Decal",shck) d.Texture = asset.."104596177" d.Face = "Top"
  145. local d = Instance.new("Decal",shck) d.Texture = asset.."104596177" d.Face = "Bottom"
  146. coroutine.wrap(function()
  147. for i = 1, 25 do
  148. local cf = shck.CFrame
  149. shck.Size = shck.Size + Vector3.new(2,0,2)
  150. shck.CFrame = cf
  151. shck.Anchored = true
  152.  
  153. for _,v in pairs(game:service("Workspace"):children()) do
  154. if v:findFirstChild("Humanoid") ~= nil and v:findFirstChild("Torso") ~= nil then
  155. if (v.Torso.Position - shck.Position).magnitude <= shck.Size.X then
  156. local dmg = math.random(2,6)
  157. v.Humanoid.Health = v.Humanoid.Health - dmg
  158. showdmg(v,dmg)
  159. end
  160. end
  161. end
  162. wait(-0.03)
  163. end
  164. shck:remove()
  165. end)()
  166. end
  167. end
  168. end))
  169.  
  170. if not Ran then
  171. print(Error)
  172. end
  173. end
  174. end
  175. shot.CFrame = shot.CFrame*CFrame.new(0,0,-5)
  176. local trl = trail(lst,shot.Position,efc)
  177. lst = trl
  178. lst = trl
  179. wait(-0.03)
  180. end
  181. end)()
  182. coroutine.wrap(function()
  183. wait(7.5)
  184. efc:remove()
  185. end)()
  186. end
  187. --
  188. if script.Parent.className ~= "HopperBin" then
  189. pcall(function() Player.Backpack["Plasma Pistol"]:remove() end)
  190. local h = Instance.new("HopperBin", Player.Backpack)
  191. h.Name = "Plasma Pistol"
  192. script.Parent = h
  193. end
  194. local bin = script.Parent
  195. function onSelected(mouse)
  196. select = true
  197. RW.Part0 = Rarm
  198. LW.Part0 = Larm
  199. RlW.Part0 = Rleg
  200. LlW.Part0 = Lleg
  201. TG.Parent = Torso
  202. local function ComputePos(pos1, pos2)
  203. local pos3 = Vector3.new(pos2.x, pos1.y, pos2.z)
  204. return CFrame.new(pos1, pos3)
  205. end
  206. coroutine.wrap(function()
  207. while select == true do
  208. TG.cframe = ComputePos(Torso.Position,mouse.hit.p)*CFrame.Angles(0,math.rad(90),0)
  209. efct()
  210. wait()
  211. end
  212. end)()
  213. for i = 0,1,.1 do
  214. RW.C1 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(0*i),math.rad(0*i),math.rad(90*i))
  215. LW.C1 = CFrame.new(0,0,0)*CFrame.Angles(math.rad(0*i),0,math.rad(-45*i))
  216. HW.C1 = CFrame.new(0,0,0)*CFrame.Angles(0,math.rad(-90*i),0)
  217. wait()
  218. end
  219. mouse.Move:connect(function()
  220. end)
  221. mouse.Button1Down:connect(function()
  222. ray(mouse.hit.p)
  223. end)
  224. mouse.KeyDown:connect(function(key)
  225. end)
  226. mouse.KeyUp:connect(function(key)
  227. end)
  228. end
  229. function onDesel(mouse)
  230. select = false
  231. TG.Parent = nil
  232. end
  233. bin.Selected:connect(onSelected)
  234. bin.Deselected:connect(onDesel)
Add Comment
Please, Sign In to add comment