memberhero

Untitled

May 2nd, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.45 KB | None | 0 0
  1. c,d=pcall(function()
  2. ply = game.Players.LocalPlayer
  3. char = ply.Character
  4. torso = char.Torso
  5. head = char.Torso
  6. track = false --- for tracking function
  7. char.Humanoid.MaxHealth,char.Humanoid.Health,char.Humanoid.WalkSpeed = 9000,9000,30
  8. dmg = 20
  9.  
  10. Bo = {["T"] = char["Torso"], ["H"] = char.Head}
  11. Bo.Arms = {["R"] = char["Right Arm"], ["L"] = char["Left Arm"]}
  12. Bo.Legs = {["L"] = char["Left Leg"], ["R"] = char["Right Leg"]}
  13. Bo.Shls = {["R"] = torso["Right Shoulder"], ["L"] = torso["Left Shoulder"]}
  14.  
  15.  
  16. rarm = char["Right Arm"]
  17. rw,lw = Instance.new("Weld"),Instance.new("Weld")
  18. normpos = Bo.Shls.R.C0
  19.  
  20. function lock(a) ---- updating this for 2 hands
  21. if a == 1 then
  22.  
  23. ---RIGHT---
  24. rw.Parent = torso
  25. rw.C0,rw.C1 = Bo.Shls.R.C0 ,Bo.Shls.R.C1
  26. rw.Part0,rw.Part1 = Bo.Shls.R.Part0 ,Bo.Shls.R.Part1
  27. Bo.Shls.R.Parent = nil
  28.  
  29. ---LEFT---
  30. lw.Parent = torso
  31. lw.Part0,lw.Part1 = Bo.Shls.L.Part0 ,Bo.Shls.L.Part1
  32. lw.C0,lw.C1 = Bo.Shls.L.C0 ,Bo.Shls.L.C1
  33.  
  34.  
  35. elseif a == 0 then
  36. Bo.Shls.R.Parent = torso
  37. rw.Parent = nil
  38. Bo.Shls.L.Parent = torso
  39. lw.Parent = nil
  40.  
  41. end
  42. end
  43.  
  44. cfn,ang = CFrame.new,CFrame.Angles
  45. v3n = Vector3.new
  46.  
  47. attacks = {
  48. ["slash"] = CFrame.Angles(1,2,3)
  49. }
  50.  
  51.  
  52.  
  53. sword = Instance.new("Model",char)
  54.  
  55. meshids = {["blast"] = 20329976, ["penguin"] = 15853464, ["ring"] = 3270017,
  56. ["spike"] = 1033714,["cone"] = 1082802,["crown"] = 20329976,["crossbow"] = 15886761,
  57. ["cloud"] = 1095708,["mjolnir"] = 1279013,["diamond"] = 9756362, ["hand"] = 37241605,
  58. ["fist"] = 65322375,["skull"] = 36869983,["totem"] = 35624068,["spikeb"] = 9982590,["dragon"] = 58430372}---some meshids
  59.  
  60.  
  61. ------TOOOOOLS------
  62. T = {["P"] = function(x,y,z,color,transparency,cancollide,anchored)
  63. c = Instance.new("Part",sword)
  64. c.TopSurface,c.BottomSurface = 0,0
  65. c.formFactor = "Custom"
  66. c.Size = Vector3.new(x,y,z)
  67. c.BrickColor = BrickColor.new(color)
  68. c.Transparency = transparency
  69. c.CanCollide = cancollide
  70. if anchored ~= nil then c.Anchored = anchored end
  71. return c
  72. end
  73. ,
  74. ["C"] = function(func) coroutine.resume(coroutine.create(func)) end
  75. ,
  76. ["W"] = function(part0,part1,x,y,z,rx,ry,rz)
  77. w = Instance.new("Weld",sword)
  78. w.Part0,w.Part1 = part0,part1
  79. w.C1 = CFrame.new(x,y,z) * CFrame.Angles(rx,ry,rz)
  80. return w
  81. end
  82. ,
  83. ["BG"] = function(parent)
  84. local c = Instance.new("BodyGyro",parent)
  85. c.P = 20e+003
  86. c.cframe = parent.CFrame
  87. c.maxTorque = Vector3.new(c.P,c.P,c.P)
  88. return c
  89. end
  90. ,
  91. ["BP"] = function(parent,position)
  92. local bp = Instance.new("BodyPosition",parent)
  93. bp.maxForce = Vector3.new()*math.huge
  94. bp.position = position
  95. return bp
  96. end
  97. ,
  98. ["F"] = function(parent,size,heat,color,secondcolor)
  99. f = Instance.new("Fire",parent)
  100. f.Size = size
  101. f.Heat = heat
  102. if color ~= nil then f.Color = BrickColor.new(color).Color end
  103. if secondcolor ~= nil then f.SecondaryColor = BrickColor.new(secondcolor).Color end
  104. return f
  105. end
  106. ,
  107. ["Track"] = function(obj,s,t,lt)
  108. coroutine.resume(coroutine.create(function()
  109. while track do
  110. old = obj.Position
  111. wait()
  112. new = obj.Position
  113.  
  114. mag = (old-new).magnitude
  115. dist = (old+new)/2
  116.  
  117. ray = T.P(s,mag+.2,s,obj.Color,t,false,true)
  118. Instance.new("CylinderMesh",ray)
  119. ray.CFrame = CFrame.new(dist,old)*ang(math.pi/2,0,0)
  120. game:GetService("Debris"):AddItem(ray,lt)
  121.  
  122. end
  123. end)) end,
  124. ["D"] = function(hit) if hit.Parent:findFirstChild("Humanoid") then h=hit.Parent.Humanoid h.Health = h.Health -dmg end end
  125. ,
  126. ["FM"] = function(parent,meshid,x,y,z,meshtexture)
  127. if meshid == "cylinder" then
  128. mesh = Instance.new("CylinderMesh",parent)
  129. mesh.Scale = Vector3.new(x,y,z)
  130. return mesh
  131. else
  132. mesh = Instance.new("SpecialMesh",parent)
  133. if meshid ~= "sphere" then
  134. mesh.MeshId = "rbxassetid://"..meshids[meshid]
  135. else mesh.MeshType = 3 end
  136. mesh.Scale = Vector3.new(x,y,z)
  137. if meshtexture ~= nil then
  138. mesh.TextureId = "rbxassetid://"..textureids[meshtexture]
  139. end
  140. return mesh
  141. end
  142. end
  143. }
  144. --------------------------------------------------
  145. ---MATH SHORTENINGS---
  146. M = {["R"] = function(a,b) return math.random(a,b) end,
  147. ["Cos"] = function(a) return math.cos(a) end,
  148. ["Sin"] = function(a) return math.sin(a) end,
  149. ["D"] = function(a) return math.rad(a) end
  150. }
  151. ---------------------------
  152.  
  153. --[[tutorial to using shortenings
  154. T.P(sizex,sizey,sizez,brickcolor,transparency,cancollide,anchored)
  155. T.W(part0,part1,x,y,z,rx,ry,rz)
  156. T.F(parent,size,heat,color,secondarycolor)
  157. T.FM(parent,meshid(see the list),scalex,scaley,scalez,textureid(optional) ) --- most usefull
  158.  
  159. M.R(a,b) creates a randomvalue beetwen a and b
  160. ]]--
  161.  
  162. p = T.P(.7,2,.7,"Bright blue",.5,false,false) --- The handle in 1 line O_O
  163. p.Name = "Handle"
  164. p.Position = torso.Position --p.CFrame = p.CFrame * CFrame.new(torso.X, torso.Y, torso.Z)
  165. T.FM(p,"cylinder",1,1,1) --- cylindermesh
  166. hw = T.W(p,torso,0,0,1,0,0,M.D(-45))
  167. holdpos = cfn(0,-1.5,0)*ang(math.pi/2,0,0)
  168. torsopos = cfn(0,0,1)*ang(0,0,M.D(-45))
  169.  
  170. crystal = T.P(1,1,1,"Bright red",.5,false,false)
  171. T.W(crystal,p,0,1,0,0,0,0)
  172. T.FM(crystal,"diamond",.5,1,.5)
  173.  
  174. p.Touched:connect(function(h)
  175. T.D(h)
  176. end)
  177.  
  178. c=nil
  179. mainweld = nil
  180. radius = 1
  181.  
  182. main = T.P(1,1,1,"White",1,false,false)
  183. mainweld = T.W(main,p,0,-1.5,0,0,0,0)
  184.  
  185.  
  186. ----SHIELD----
  187. sp = T.P(2,4,.5,"Magenta",.5,false,false)
  188. sp2 = T.P(1,4,.5,"Magenta",.5,false,false)
  189. sp3 = T.P(1,4,.5,"Magenta",.5,false,false)
  190. --sp,sp2,sp3.Transparency = 0.5,0.5,0.5
  191. T.W(sp2,sp,-1.4,0,.15,0,M.D(20),0)
  192. T.W(sp3,sp,1.4,0,.15,0,M.D(-20),0)
  193.  
  194. mw = T.W(sp,Bo.Arms.L,-.5,0,0,0,math.pi/2,0,0)
  195. ----------------------------------------
  196.  
  197. for i = 1,360,60 do --- I weld diamonds to part at bottom of handle
  198. c = T.P(1,1,1,"White",.5,false,false)
  199. T.FM(c,"diamond",.5,1.4,.5)
  200.  
  201. T.W(c,main,M.Cos(M.D(i))*radius,0,M.Sin(M.D(i))*radius,0,0,0)
  202. end
  203.  
  204. T.C(function() -- ROTATE
  205. while true do
  206. wait()
  207. mainweld.C1 = mainweld.C1 * ang(0,M.D(10),0)
  208. end
  209. end)
  210.  
  211.  
  212. T.C(function()
  213. while wait(0.1) do
  214. for i = 0,1,0.1 do
  215. p.Transparency = i
  216. wait()
  217. end
  218.  
  219. for i = 1,0,0.1 do
  220. p.Transparency = i
  221. wait()
  222. end
  223.  
  224. end
  225. end) -- Same as coroutine.create
  226.  
  227. p2 = p:Clone()
  228. p2.Parent = sword
  229. p2.Size = Vector3.new(1,6,1)
  230. p2.Touched:connect(function(hit) T.D(hit,5) end)
  231.  
  232. p3 = T.P(1,3,1,"Black",.5,false,false)
  233. T.FM(p3,"spike",1,3,1)
  234. T.W(p3,p2,0,-4,0,math.pi,0,0)
  235. Instance.new("Sparkles",p)
  236. w=Instance.new("Weld",p)
  237. w.Part0 = p
  238. w.Part1 = p2
  239. w.C1 = cfn(0,4,0)
  240. end)
  241. if c == true then
  242. print("Sucsess loading")
  243. else
  244. print(d)
  245. end
  246.  
  247. bg = nil
  248. bp = nil
  249. ---------ANIMATIONS--------------
  250.  
  251.  
  252.  
  253. function BBGui(Text,Adornee,Par)
  254. b=Instance.new("BillboardGui",Par)
  255. b.Adornee = Adornee
  256. f=Instance.new("Frame",b)
  257. f.BackgroundTransparency = 1
  258. t=Instance.new("TextLabel",b)
  259. t.Text = Text
  260. t.TextColor3 = Color3.new(1,0,1)
  261. return b
  262. end
  263.  
  264.  
  265.  
  266.  
  267. anims = {}
  268.  
  269. anims.Twirl = function()
  270. rw.C0 = rw.C0 * ang(-math.pi/2,0,0)
  271. hw.C0 = hw.C0 * ang(math.pi/2,0,0)
  272.  
  273. bg = T.BG(head)
  274. for i = 1,360*5,20 do
  275. bg.cframe = bg.cframe * ang(0,math.rad(20),0) --rw.C0 = rw.C0 * ang(i)
  276. local ball = T.P(2,2,2,"Lime green",.5,false,false)
  277. ball.Position = (p3.CFrame * cfn(0,p3.Size.y/2,0)).p
  278. bv = Instance.new("BodyVelocity",ball)
  279. bv.maxForce = Vector3.new()*math.huge
  280. bv.velocity = cfn(torso.Position,p3.Position).lookVector * 300
  281. delay(.1,function()
  282. local pos = cfn(ball.Position)
  283. T.C(function()
  284. local pa = T.P(1,1,1,"White",0,false,true)
  285. pa.CFrame = pos
  286. msh = T.FM(pa,"sphere",1,1,1)
  287.  
  288. for i = 1,30 do
  289. wait()
  290. pa.Size = v3n(i,i,i)
  291. pa.CFrame = pos
  292. pa.Transparency = i/30
  293. end
  294. pa:Remove()
  295. end)
  296. ball:Remove()
  297. end)
  298. wait()
  299. end
  300. bg:Remove()
  301. rw.C0 = rw.C0 * ang(math.pi/2,0,0)
  302. hw.C0 = hw.C0 * ang(-math.pi/2,0,0)
  303. end
  304.  
  305. anims.Fire = function()
  306. local f=Instance.new("Fire",p3)
  307. dmg = 40
  308. delay(20,function()
  309. f:remove()
  310. dmg = 20
  311. end)
  312. end
  313.  
  314. anims.ShieldUp = function()
  315. for i = 1,50,20 do
  316. wait()
  317. lw.C0 = lw.C0 * ang(0,0,M.D(-20))
  318. end
  319. for i = 1,50,20 do
  320. wait()
  321. lw.C0 = lw.C0 * ang(M.D(20),0,0)
  322. end
  323. end
  324.  
  325. anims.ShieldDown = function()
  326. for i = 1,50,20 do
  327. wait()
  328. lw.C0 = lw.C0 * ang(M.D(-20),0,0)
  329. end
  330. for i = 1,50,20 do
  331. wait()
  332. lw.C0 = lw.C0 * ang(0,0,M.D(20))
  333. end
  334.  
  335. end
  336.  
  337.  
  338. anims.Equip = function()
  339. for i = 1,220,20 do
  340. wait()
  341. rw.C0 = rw.C0 * ang(0,0,M.D(20))
  342. end
  343. hw.Part1,hw.C1 = Bo.Arms.R,holdpos
  344. for i = 1,220-90,20 do
  345. wait()
  346. rw.C0 = rw.C0 * ang(0,0,M.D(-20))
  347. end
  348. rw.C0 = normpos*ang(0,0,math.pi/2)
  349. end
  350.  
  351. anims.UnEquip = function()
  352. for i = 1,180,20 do
  353. wait()
  354. rw.C0 = rw.C0 * ang(0,0,M.D(20))
  355. end
  356. hw.Part1,hw.C1 = torso,torsopos
  357. for i = 1,220,20 do
  358. wait()
  359. rw.C0 = rw.C0 * ang(0,0,M.D(-20))
  360. end
  361. end
  362.  
  363. anims.Equip2 = function()
  364. for i = 1,90,5 do
  365. wait()
  366. rw.C0 = rw.C0 * ang(0,0,M.D(5))
  367. end rw.C0 = normpos * ang(0,0,M.D(90)) end
  368.  
  369. anims.UnEquip2 = function()
  370. for i = 90,0,-20 do
  371. wait()
  372. rw.C0 = rw.C0 * ang(0,0,M.D(-20))
  373. end
  374. end
  375.  
  376. anims.Slash = function()
  377. for i = 1,90,20 do
  378. rw.C0 = rw.C0 * ang(0,M.D(20),0)
  379. wait()
  380. end
  381.  
  382. for i = 90,1,-20 do
  383. rw.C0 = rw.C0 * ang(0,0,M.D(-20))
  384. wait()
  385. end
  386. for i = 90,1,-20 do
  387. rw.C0 = rw.C0 * ang(0,0,M.D(20))
  388. wait()
  389. end
  390.  
  391. for i = 1,90,20 do
  392. rw.C0 = rw.C0 * ang(0,M.D(-20),0)
  393. wait()
  394. end
  395. end
  396.  
  397. anims.Fist = function(mouse)
  398. pa = T.P(1,1,1,"Black",.5,false,false)
  399.  
  400. --[[p=Instance.new("Part",Workspace)
  401. p.Anchored = true --flying fist? ya]]--
  402.  
  403. T.FM(p,"fist",1,1,1)
  404. T.W(p,Bo.Arms.L,0,-2,0,0,0,0)
  405.  
  406. end
  407.  
  408. anims.dragon = function(mouse)
  409. local endpos = mouse.hit.p
  410. for i = 1,90,20 do
  411. lw.C0 = lw.C0 * ang(0,0,M.D(-20))
  412. end
  413.  
  414. for i = 1,50,10 do
  415. lw.C0 = lw.C0 * ang(M.D(-10),0,0)
  416. end
  417.  
  418. local ray = T.P(5,1,5,"Bright red",.5,false,true)
  419. startpos = sp.CFrame * cfn(0,0,-1)
  420. T.FM(ray,"cylinder",1,1,1)
  421.  
  422. ray.CFrame = startpos
  423.  
  424.  
  425.  
  426. mag = (startpos.p-endpos).magnitude
  427.  
  428. local head = T.P(1,1,1,"Bright red",.5,false,true)
  429. T.FM(head,"dragon",4,4,4)
  430.  
  431. for i = 1,mag do
  432. wait()
  433. startpos = sp.CFrame * cfn(0,0,-1)
  434. ray.Size = v3n(5,i,5)
  435. ray.CFrame = (cfn(startpos.p,endpos)*cfn(0,0,-ray.Size.y/2))*ang(math.pi/2,0,0)
  436. head.CFrame = ray.CFrame * cfn(0,-ray.Size.y/2,0) * ang(-math.pi/2,0,0)
  437. end
  438.  
  439. for i = 1,50,10 do
  440. lw.C0 = lw.C0 * ang(M.D(10),0,0)
  441. end
  442.  
  443. for i = 1,90,20 do
  444. lw.C0 = lw.C0 * ang(0,0,M.D(20))
  445. end
  446.  
  447. ray:Remove() head:Remove()
  448. end
  449.  
  450.  
  451. swirling = false
  452. anims.Swirl = function(mouse)
  453. if swirling == false and mouse.Target ~= nil then
  454. swirling = true
  455. eff = function(a)
  456. T.C(function()
  457. wait()
  458. local p = T.P(1,1,1,"Black",.5,false,true)
  459. p.CFrame = a
  460. local msh = T.FM(p,"blast",1,1,1)
  461. for i = 1,30 do
  462. wait()
  463. msh.Scale = Vector3.new(i,i/2,i)
  464. p.Transparency = i/30
  465. end
  466. p:Remove()
  467. end)
  468. end
  469.  
  470. rw.C0 = normpos * ang(0,0,math.pi)
  471. hw.C0 = hw.C0 * ang(math.pi/2,0,0)
  472. bg = T.BG(torso)
  473. local original = bg.cframe
  474. --T.C(function() while swirling do wait() bg.cframe = bg.cframe * ang(0,M.D(100),0) end end)
  475. eff(torso.CFrame *cfn(0,-3,0))
  476. bp = T.BP(torso,torso.Position + v3n(0,70,0))
  477. while (bp.position-torso.Position).magnitude > 3 do wait() end --- waits
  478.  
  479. if mouse.Target ~= nil then
  480. bg.cframe = cfn(torso.Position,mouse.hit.p) * ang(-math.pi/2,0,0)
  481. bp.position = (mouse.hit.p + v3n(0,3,0))
  482.  
  483. eff(bg.cframe * ang(math.pi,0,0))
  484.  
  485. while (bp.position-torso.Position).magnitude > 5 do wait() end --- waits
  486.  
  487. bg.cframe = original bp:Remove()
  488. game:GetService("Debris"):AddItem(bg,.5)
  489.  
  490. rw.C0 = normpos * ang(0,0,math.pi/2)
  491. hw.C0 = hw.C0 * ang(-math.pi/2,0,0)
  492. swirling = false
  493. end
  494.  
  495. else
  496. bp:Remove() bg:Remove() rw.C0 = normpos * ang(0,0,math.pi/2)
  497. hw.C0 = hw.C0 * ang(-math.pi/2,0,0)
  498.  
  499. end
  500. end
  501.  
  502. radi = 5
  503. atk = {"Twirl","Fire","Swirl","Dragon","Slash","Fist","ShieldUp"}
  504.  
  505.  
  506. function createhumanoid(name,part,parent)
  507. mo = Instance.new("Model",parent)
  508. mo.Name = name
  509. part.Name = "Head"
  510. part.Parent = mo
  511. tor = T.P(.1,.1,.1,"White",1,false,false)
  512. tor.Name = "Torso"
  513. tor.Parent = mo
  514. T.W(tor,part,0,0,0,0,0,0)
  515. hum = Instance.new("Humanoid",mo)
  516. hum.Health = 0
  517. hum.MaxHealth = 0
  518. end
  519. ---------------------------------
  520. tab = nil
  521.  
  522. scrbox = nil
  523. current = 1
  524.  
  525. function scroll(direction)
  526. if scrbox ~= nil then
  527. current = current+(direction)
  528.  
  529. if current > #atk then current = 1
  530. elseif current < 1 then current = #atk
  531. end
  532.  
  533. scrbox.Adornee = tab:GetChildren()[current]
  534. end
  535.  
  536. end
  537.  
  538.  
  539. ply.Chatted:connect(function(msg)
  540.  
  541. if msg == "#accept" and mod ~= nil then
  542. anims[atk[current]]()
  543. end
  544.  
  545. end)
  546.  
  547. function showtablets()
  548. if tab == nil then
  549.  
  550. tab = Instance.new("Model",sword)
  551.  
  552. for i,v in pairs(atk) do
  553. tp = T.P(2,1.5,2,"Black",.5,false,false)
  554. tp.Parent = tab
  555. createhumanoid(v,tp,tab)
  556.  
  557. local bp = T.BP(tp,torso.Position)
  558.  
  559. T.C(function()
  560. while true do
  561. wait()
  562. o = 360/#atk*i
  563. bp.position = torso.Position + v3n(M.Cos(M.D(o))*radi,0,M.Sin(M.D(o))*radi)
  564. end
  565. end)
  566.  
  567. end
  568.  
  569. scrbox = Instance.new("SelectionBox",Workspace)
  570. scrbox.Adornee = tab:GetChildren()[current]
  571.  
  572. elseif tab ~= nil then tab:Remove() tab = nil
  573. end
  574. end
  575.  
  576. -------------------------------------
  577.  
  578. hopper = Instance.new("HopperBin",ply.Backpack)
  579. hopper.Name = "Crystal Lance"
  580.  
  581. hopper.Deselected:connect(function()
  582. anims.UnEquip()
  583. lock(0) track = false
  584. end)
  585.  
  586.  
  587. hopper.Selected:connect(function(mouse)
  588. lock(1)
  589. anims.Equip()
  590. track = true
  591. T.Track(p2,.3,.5,1)
  592.  
  593. mouse.KeyUp:connect(function(key)
  594. if key == string.char(48) then anims.ShieldDown()
  595. end end)
  596.  
  597. mouse.KeyDown:connect(function(key)
  598. k=key:lower()
  599. if k == "f" then anims.Slash()
  600. elseif k == "q" then anims.UnEquip2() wait(1) anims.Equip2()
  601. elseif k == "t" then anims.Twirl()
  602. elseif key == "r" then anims.Swirl(mouse)
  603. elseif key == "k" then anims.Fire()
  604. elseif key == string.char(48) then anims.ShieldUp()
  605. elseif key == "j" then anims.Fist(mouse)
  606. elseif key == "g" then anims.dragon(mouse)
  607.  
  608. elseif key == "x" then showtablets()
  609. elseif key == "z" then scroll(-1) elseif key == "c" then scroll(1)
  610. elseif key == "v" then if scrbox ~= nil then anims[scrbox.Adornee.Name](mouse) end
  611.  
  612. end
  613. end)
  614.  
  615. end)
Add Comment
Please, Sign In to add comment