Advertisement
memberhero

Untitled

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