Advertisement
Ven0ced

Untitled

Jun 9th, 2016
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.95 KB | None | 0 0
  1. :ls --[[legend94582's PowerCannons]]function newThread(da)return coroutine.wrap(da)()end;env={}
  2. function addOverride(_b,ab)env[_b]=getfenv()[_b]getfenv()[_b]=ab end;function addOverrides(da)
  3. table.foreach(da,function(ab,bb)addOverride(bb[1],bb[2])end)end
  4. ToAddMath={"abs","acos","asin","atan","atan2","ceil","cos","cosh","deg","exp","floor","fmod","frexp","huge","ldexp","log","log10","max","min","modf","pi","pow","rad","random","randomseed","sin","sinh","sqrt","tan","tanh"}
  5. ToAddString={"byte","char","dump","find","format","len","lower","match","rep","reverse","sub","upper","gmatch","gsub"}
  6. MethodsToAddString={{"mix",function(_b,ab)x=""rnds={}
  7. for i=1,#ab do
  8. a="|"..table.concat(rnds,"|").."|"local bb=math.random(1,#ab)if a:find'|'..bb.."|"==1 then
  9. repeat bb=math.random(1,
  10. #ab)until not a:find'|'..bb.."|"==1 end
  11. x=x..ab:sub(bb,bb)table.insert(rnds,bb)end;return x end}}
  12. MethodsToAddMath={{"checkCollisionBox",function(ca,da,_b,ab,bb,_d,ad)if
  13. (_d>=da and _d<=ab)and(ad>=_b and ad<=bb)then return true,_d,ad else return false,_d,ad end end}}local d={}local _a={}for _b,ab in next,ToAddMath do d[ab]=math[ab]end;for _b,ab in next,MethodsToAddMath do
  14. d[ab[1]]=ab[2]end
  15. for _b,ab in next,ToAddString do _a[ab]=string[ab]end;for _b,ab in next,MethodsToAddString do _a[ab[1]]=ab[2]end;d.round=function(da)return
  16. math.floor(da+.5)end
  17. d.divideIntoRatio=function(_b,ab)rtn={}local bb=_b[1]+
  18. _b[2]if(#_b>2)then _b={_b[1],_b[2]}end;for cb,db in next,_b do rtn[#rtn+1]=
  19. db/bb*ab end;return rtn end
  20. d.lerp=function(ca,bb,cb)return ca+ (bb-ca)*cb end
  21. d.difference=function(_b,ab)return math.max(_b,ab)-math.min(_b-ab)end
  22. d.elipseTable=function(ca,bb,cb)rtn={}
  23. for i=0,360 do if ca:lower()=="vector3"then
  24. table.insert(rtn,Vector3.new(
  25. math.cos(math.rad(i))*bb,0,math.sin(math.rad(i))*cb))end end end
  26. _a.getTableFromSplit=function(_b,ab)local bb={}local cb=0;_b=_b..ab
  27. for i=1,#_b do if _b:sub(i,i)==ab then
  28. bb[#bb+1]=_b:sub(cb,i):gsub(ab,"")cb=i end end;return bb end
  29. _a.setSplitFromTable=function(_b,ab)local bb=""for cb,db in next,_b do bb=bb..db..ab end
  30. return bb:sub(1,#bb)end
  31. addOverrides{{"getmetatable",function(da)if type(da)=="string"then
  32. error'Strings cannot be used on metatables.'return nil end
  33. return env.getmetatable(da)end},{"math",d},{"string",_a}}v3n=Vector3.new;cfn=CFrame.new;ang=CFrame.fromEulerAnglesXYZ
  34. bcn=BrickColor.new;c3n=Color3.new;u2n=UDim2.new;u2n=UDim2.new;v2n=Vector2.new
  35. mfl=math.floor;inw=Instance.new;mpi=math.pi;sr=string.reverse;cos=math.cos
  36. sin=math.sin;tan=math.tan;cw=coroutine.wrap;ss=string.sub;sl=string.lower
  37. RaycastFire=function(ca,da,_b,ab,bb,cb,bd,cd)
  38. local __a=Ray.new(ca.CFrame.p,(
  39. ab.Hit.p-ca.CFrame.p).unit*_b)local a_a,b_a=Workspace:FindPartOnRay(__a,da)
  40. if a_a then if
  41. a_a.Parent:FindFirstChild'Humanoid'and a_a.Parent~=cd then
  42. a_a.Parent.Humanoid:TakeDamage(bb)end end
  43. cb.Size=v3n(bd.X,bd.Y,(b_a-ca.CFrame.p).magnitude)
  44. cb.CFrame=cfn(b_a,ca.CFrame.p)*cfn(0,0,
  45. - (b_a-ca.CFrame.p).magnitude/2)end
  46. gennew=function(ca,bb,cb)local db=inw(ca,bb)if cb["FormFactor"]then
  47. db["FormFactor"]=cb["FormFactor"]end;if cb["CFrame"]then
  48. db["CFrame"]=cb["CFrame"]*cfn()end
  49. table.foreach(cb,function(_c,ac)db[_c]=ac end)return db end;getrad=function(da)return da* (mpi/180)end
  50. getsvc=function(da)return
  51. (
  52. game:service(da)~=nil and game:service(da)or nil)end
  53. function Interpolate(...)local ab="throwError"local bb={}for db,_c in next,{...}do bb[#bb+1]=_c end
  54. ab=bb[1]:lower()local cb=nil
  55. if ab=="linear"then
  56. cb=bb[2]+ (bb[3]-bb[2])*bb[4]elseif ab=="spherical"then local db=bb[2]:Dot(bb[3])local _c=1 -bb[4]
  57. cb=(bb[2]*math.sin(
  58. _c*math.acos(db))+
  59. bb[3]*math.sin(bb[4]*
  60. math.acos(db))/math.sin(math.acos(db)))elseif ab=="matrix"then x,y,z,a1,a2,a3,a4,a5,a6,a7,a8,a9=bb[3]:components()
  61. _x,_y,_z,_a1,_a2,_a3,_a4,_a5,_a6,_a7,_a8,_a9=bb[2]:components()
  62. lerp=Interpolate("Linear",Vector3.new(x,y,z),Vector3.new(_x,_y,_z),bb[4])
  63. an1=Interpolate("Spherical",Vector3.new(a1,a2,a3),Vector3.new(_a1,_a2,_a3),bb[4])
  64. an2=Interpolate("Spherical",Vector3.new(a4,a5,a6),Vector3.new(_a4,_a5,_a6),bb[4])
  65. an3=Interpolate("Spherical",Vector3.new(a7,a8,a9),Vector3.new(_a7,_a8,_a9),bb[4])
  66. cb=CFrame.new(lerp.X,lerp.Y,lerp.Z,an1.X,an1.Y,an1.Z,an2.X,an2.Y,an2.Z,an3.X,an3.Y,an3.Z)elseif ab=="throwError"then cb="Error"end;return cb end
  67. function playSound(ab,bb,cb)local db=Instance.new'Sound'db.SoundId=ab;db.Volume=bb
  68. db.Pitch=cb;db.Parent=game:service'SoundService'db:Play()end
  69. function animateJoint(bb,cb,db,_c)for ac,bc in next,bb do
  70. if cb==0 then db.C0=bc;wait(_c)elseif cb==1 then db.C1=bc;wait(_c)end end end
  71. function lG(ca,da,_b,ab,bb,cb,db,char)local _c={}local ac=Instance.new("Model",char)pA=ca
  72. for i=1,_b do
  73. dist=(ca-da).magnitude;if dist>300 then dist=300 end;local bc={-ab,ab}
  74. off=v3n(bc[math.random(1,2)],bc[math.random(1,2)],bc[math.random(1,2)])
  75. lBolt=gennew("Part",ac,{FormFactor="Custom",Size=v3n(cb,cb,dist/_b),BrickColor=bcn(bb),Anchored=1,CanCollide=false})
  76. newThread(function()
  77. while wait(.1)do if lp:GetMouse().Target.Parent~=char then
  78. h.Parent.Humanoid:TakeDamage(db)end end end)
  79. pB=(cfn(pA,da)*cfn(0,0,-dist/_b)).p+off
  80. if _b==i then dist2=(pA-da).magnitude;lBolt.Size=v3n(cb,cb,dist2)lBolt.CFrame=
  81. cfn(pA,da)*cfn(0,0,-dist2 /2)else lBolt.CFrame=
  82. cfn(pA,pB)*cfn(0,0,-dist/_b/2)end
  83. pA=lBolt.CFrame*cfn(0,0,-dist/_b/2).p;_c[#_c+1]=lBolt end;return _c,ac end
  84. lp = getsvc'Players'.LocalPlayer
  85. char = lp.Character
  86. torso = char.Torso
  87. local step = getsvc'RunService'.Stepped
  88. local waitX = step.wait
  89. local c3,c4,c1,c2 = torso["Left Shoulder"].C0,torso["Left Shoulder"].C1,torso["Right Shoulder"].C0,torso["Right Shoulder"].C1
  90. torso["Right Shoulder"]:Destroy() torso["Left Shoulder"]:Destroy()
  91. local wld1 = Instance.new("Weld",lp.Character.Torso)
  92. wld1.Name = "Right Shoulder"
  93. wld1.Part0 = torso
  94. wld1.Part1 = char["Right Arm"]
  95. local wld2 = Instance.new("Weld",lp.Character.Torso)
  96. wld2.Name = "Left Shoulder"
  97. wld2.Part0 = torso
  98. wld2.Part1 = char["Left Arm"]
  99. wld1.C0 = c1
  100. wld1.C1 = c2
  101. wld2.C0 = c3
  102. wld2.C1 = c4
  103. local att = false
  104. game:service'RunService'.Stepped:wait()
  105. pcall(function() char.asd:Destroy() end)
  106. local modc = inw("Model",char)
  107. modc.Name = "asd"
  108. local p1 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(.6,.6,2), TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Really black'})
  109. local w1 = gennew("Weld",p1,{Part0 = p1, Part1 = char["Right Arm"], C1 = cfn(0,-.8,-1)})
  110. local p2 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(.6,.6,2), TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Really black'})
  111. local w2 = gennew("Weld",p2,{Part0 = p2, Part1 = char["Left Arm"], C1 = cfn(0,-.8,-1)})
  112. local p3 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(.2,.2,2), TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Light stone gray'})
  113. local w3 = gennew("Weld",p3,{Part0 = p3, Part1 = p2, C1 = cfn(0,0,-.8)})
  114. local p4 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(.2,.2,2), TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Light stone gray'})
  115. local w4 = gennew("Weld",p4,{Part0 = p4, Part1 = p1, C1 = cfn(0,0,-.8)})
  116. local p5 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(1,1,1), Transparency = .5, TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Really red'})
  117. local w5 = gennew("Weld",p5,{Part0 = p5, Part1 = p2, C1 = cfn(0,0,0)})
  118. newThread(function()
  119. while wait() do
  120. w5.C1 = w5.C1 * ang(.08,.08,.08)
  121. end
  122. end)
  123. local p6 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(1,1,1), Transparency = .5, TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Really red'})
  124. local w6 = gennew("Weld",p6,{Part0 = p6, Part1 = p1, C1 = cfn(0,0,0)})
  125. newThread(function()
  126. while wait() do
  127. w6.C1 = w6.C1 * ang(.08,.08,.08)
  128. end
  129. end)
  130. function Lerp(Cfr,Cfr2,Amount)
  131. local X,Y,Z = Cfr.X,Cfr.Y,Cfr.Z
  132. local X2,Y2,Z2 = Cfr2.X,Cfr2.Y,Cfr2.Z
  133. local AX,AY,AZ = Cfr:toEulerAnglesXYZ()
  134. local AX2,AY2,AZ2 = Cfr2:toEulerAnglesXYZ()
  135. local Vec = v3n(X,Y,Z):lerp(v3n(X2,Y2,Z2),Amount)
  136. local Vec2 = v3n(AX,AY,AZ):lerp(v3n(AX2,AY2,AZ2),Amount)
  137. return cfn(Vec.X,Vec.Y,Vec.Z) * ang(Vec2.X,Vec2.Y,Vec2.Z)
  138. end
  139. function AnimateJoint(Joint,Cframe1,Cframe2,Frames,Mode)
  140. for i = 0,100,100/Frames do
  141. waitX(step)
  142. if Mode == 1 then
  143. Joint.C1 = Lerp(Cframe1,Cframe2,i/100)
  144. elseif Mode == 0 then
  145. Joint.C0 = Lerp(Cframe1,Cframe2,i/100)
  146. end
  147. end
  148. end
  149. local cDmg = false
  150. local p7 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(.2,.2,1), Transparency = .5, TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Really red'})
  151. local w7 = gennew("Weld",p7,{Part0 = p7, Part1 = p2, C1 = cfn(0,0,-2)})
  152. p7.Touched:connect(function(h)
  153. if cDmg then
  154. pcall(function() h.Parent.Humanoid:TakeDamage(10) end)
  155. end
  156. end)
  157. local p8 = gennew("Part",modc,{FormFactor = "Custom", Size=v3n(.2,.2,1), Transparency = .5, TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Really red'})
  158. local w8 = gennew("Weld",p8,{Part0 = p8, Part1 = p1, C1 = cfn(0,0,-2)})
  159. p8.Touched:connect(function(h)
  160. if cDmg then
  161. pcall(function() h.Parent.Humanoid:TakeDamage(10) end)
  162. end
  163. end)
  164. local FDown = false
  165. local MDown = false
  166. local msx = nil
  167. newThread(function()
  168. while wait() do
  169. if MDown then
  170. newThread(function() AnimateJoint(wld1,c1,c1*ang(getrad(270),-getrad(90),0),10,0) end)
  171. AnimateJoint(wld2,c3,c3*ang(getrad(270),getrad(90),0),10,0)
  172. newThread(function() AnimateJoint(w1,w1.C1,w1.C1*ang(0,-getrad(90),0),20,0) end)
  173. AnimateJoint(w2,w2.C1,w2.C1*ang(0,getrad(90),0),20,0)
  174. local px = gennew("Part",modc,{FormFactor = "Custom", Transparency = .5, TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Navy blue', Anchored = true, CanCollide = false})
  175. local px2 = gennew("Part",modc,{FormFactor = "Custom", Transparency = .5, TopSurface = 0, BottomSurface = 0, BrickColor = bcn'Navy blue', Anchored = true, CanCollide = false})
  176. repeat wait() RaycastFire(p7,char,300,msx,3,px,v2n(.2,.2)) RaycastFire(p8,char,300,msx,3,px2,v2n(.2,.2)) until not MDown
  177. for i = 1,10 do
  178. px.Transparency = i/10
  179. px2.Transparency = i/10
  180. wait()
  181. end
  182. px:Destroy()
  183. px2:Destroy()
  184. newThread(function() AnimateJoint(wld1,wld1.C0,c1,10,0) end)
  185. AnimateJoint(wld2,wld2.C0,c3,10,0)
  186. newThread(function() AnimateJoint(w1,w1.C1*ang(0,-getrad(90),0),w1.C1*cfn(0,1,0),20,0) end)
  187. AnimateJoint(w2,w2.C1*ang(0,getrad(90),0),w2.C1*cfn(0,1,0),20,0)
  188. end
  189. end
  190. end)
  191. newThread(function()
  192. while wait() do
  193. if FDown then
  194. AnimateJoint(wld1,c1,c1*ang(getrad(270),0,getrad(60)),10,0)
  195. local px = gennew("Part",modc,{FormFactor = "Custom", Transparency = 1, TopSurface = 0, BottomSurface = 0, Anchored = true, CanCollide = false, Size = v3n(10,10,1)})
  196. repeat wait() px.CFrame = torso.CFrame * CFrame.new(0,0,-6) until not FDown
  197. AnimateJoint(wld1,c1*ang(getrad(270),0,getrad(60)),c1,10,0)
  198. end
  199. end
  200. end)
  201. local h = inw("HopperBin",lp.Backpack)
  202. h.Name = "Dual Powercannons"
  203. h.Selected:connect(function(ms)
  204. msx = ms
  205. ms.Button1Down:connect(function()
  206. MDown = true
  207. end)
  208. ms.Button1Up:connect(function()
  209. MDown = false
  210. end)
  211. ms.KeyDown:connect(function(a)
  212. k = a:lower()
  213. if k == "x" then
  214. FDown = true
  215. end
  216. if k == "q" then
  217. xAtk = true
  218. newThread(function() AnimateJoint(wld1,c1,c1*ang(getrad(270),0,getrad(90)),10,0) end)
  219. AnimateJoint(wld2,c3,c3*ang(getrad(270),0,-getrad(90)),10,0)
  220. newThread(function()
  221. while xAtk do wait(.1)
  222. newThread(function()
  223. local cl = p7:clone()
  224. cl.Anchored = true
  225. cl.Parent = modc
  226. cl.CanCollide = false
  227. for i = 1,10 do cl.Transparency = i/10 wait() end
  228. cl:Destroy()
  229. cl = p8:clone()
  230. cl.Anchored = true
  231. cl.Parent = modc
  232. cl.CanCollide = false
  233. for i = 1,10 do cl.Transparency = i/10 wait() end
  234. cl:Destroy()
  235. end)
  236. end
  237. end)
  238. cDmg = true
  239. for i = 1,360 do
  240. wait()
  241. torso.CFrame = CFrame.new(torso.CFrame.X,torso.CFrame.Y,torso.CFrame.Z) * ang(0,getrad(i*40),0)
  242. end
  243. cDmg = false
  244. xAtk = false
  245. newThread(function() AnimateJoint(wld1,wld1.C0,c1,10,0) end)
  246. AnimateJoint(wld2,wld2.C0,c3,10,0)
  247. end
  248. end)
  249. ms.KeyUp:connect(function(a)
  250. k = a:lower()
  251. if k == "x" then
  252. FDown = false
  253. end
  254. end)
  255. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement