deyzaeuhfowkf

descent blade

May 26th, 2017
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.93 KB | None | 0 0
  1. -- Config stuff
  2. local wspeed = 100
  3.  
  4.  
  5. -- Initial stuff
  6. math.randomseed(tick())
  7.  
  8.  
  9. -- Wait for character
  10. repeat wait() until game.Players.LocalPlayer.Character ~= nil
  11.  
  12.  
  13. -- Useful shortcuts
  14. local plr = game:GetService("Players").LocalPlayer
  15. local char = plr.Character
  16. local plrgui = plr.PlayerGui
  17. local backpack = plr.Backpack
  18. local torso = char.Torso
  19. local head = char.Head
  20. local hum = char.Humanoid
  21. local larm = char["Left Arm"]
  22. local lleg = char["Left Leg"]
  23. local rarm = char["Right Arm"]
  24. local rleg = char["Right Leg"]
  25. local LS = torso["Left Shoulder"]
  26. local LH = torso["Left Hip"]
  27. local RS = torso["Right Shoulder"]
  28. local RH = torso["Right Hip"]
  29. local neck = torso.Neck
  30. local bc = BrickColor.new
  31. local it = Instance.new
  32. local vt = Vector3.new
  33. local cf = CFrame.new
  34. local euler = CFrame.fromEulerAnglesXYZ
  35. local angles = CFrame.Angles
  36. local RP = char.HumanoidRootPart
  37. local RJ = RP.RootJoint
  38. local RJC0 = cf(0,0,0)*euler(-1.57,0,3.14)
  39.  
  40.  
  41. -- Wait for mouse
  42. local mouse
  43. while true do
  44. mouse = plr:GetMouse()
  45. if mouse then break end
  46. wait(.1)
  47. end
  48.  
  49.  
  50. -- Welds
  51. local LAW, RAW, LLW, RLW, HW = Instance.new("Weld",torso), Instance.new("Weld",torso), Instance.new("Weld",torso), Instance.new("Weld",torso), Instance.new("Weld",torso)
  52. LAW.Name = "Left Weld" RAW.Name = "Right Weld" LLW.Name = "Left Leg Weld" RLW.Name = "Right Leg Weld" HW.Name = "Head Weld"
  53. LAW.Part0 = torso RAW.Part0 = torso LLW.Part0 = torso RLW.Part0 = torso HW.Part0 = torso
  54.  
  55.  
  56. -- Sound effects
  57. local sounds = {}
  58. sounds.explosion = "http://www.roblox.com/asset/?id=87784452"
  59. sounds.bewm = "http://www.roblox.com/asset/?id=2767090"
  60. sounds.slice = "http://www.roblox.com/asset/?id=161006195"
  61. sounds.charge = "http://roblox.com/asset/?id=2101137"
  62. sounds.sharpblast = "http://roblox.com/asset/?id=2248511"
  63. sounds.woosh = "http://roblox.com/asset/?id=147722227"
  64. sounds.metalhit = "http://roblox.com/asset/?id=153092348"
  65. sounds.mechblast = "http://roblox.com/asset/?id=169380505"
  66. sounds.chargepulse = "http://roblox.com/asset/?id=10209296"
  67. sounds.heal = "http://roblox.com/asset/?id=2101144"
  68. sounds.zap = "http://roblox.com/asset/?id=10756104"
  69. sounds.powernote = "http://roblox.com/asset/?id=192603389"
  70. sounds.swing = "http://roblox.com/asset/?id=10209640"
  71. sounds.hit = "http://roblox.com/asset/?id=10209590"
  72.  
  73.  
  74. -- Base functions
  75. --[[local wait = function(t)
  76. if t ~= nil then
  77. return wait(t)
  78. else
  79. local t = tick()
  80. game:GetService("RunService").RenderStepped:wait()
  81. return tick() - t, time()
  82. end
  83. end]]
  84. local nolines = function(p)
  85. p.TopSurface, p.BottomSurface, p.LeftSurface, p.RightSurface, p.FrontSurface, p.BackSurface = 10, 10, 10, 10, 10, 10
  86. end
  87. local part = function(formfactor,parent,reflectance,transparency,brickcolor,name,size)
  88. local fp = it("Part")
  89. fp.formFactor = formfactor
  90. fp.Parent = parent
  91. fp.Reflectance = reflectance
  92. fp.Transparency = transparency
  93. fp.CanCollide = false
  94. fp.Locked = true
  95. fp.BrickColor = brickcolor
  96. fp.Name = name
  97. fp.Size = size
  98. fp.Position = torso.Position
  99. fp.Material = "SmoothPlastic"
  100. fp:BreakJoints()
  101. nolines(fp)
  102. return fp
  103. end
  104. local mesh = function(instance,part,meshtype,meshid,offset,scale)
  105. local mesh = it(instance)
  106. mesh.Parent = part
  107. if instance == "SpecialMesh" then
  108. mesh.MeshType = meshtype
  109. if meshid ~= nil then
  110. mesh.MeshId = "http://www.roblox.com/asset/?id="..meshid
  111. end
  112. end
  113. mesh.Offset=offset
  114. mesh.Scale=scale
  115. return mesh
  116. end
  117. local weld = function(parent,part0,part1,c0)
  118. local weld = it("Weld")
  119. weld.Parent = parent
  120. weld.Part0 = part0
  121. weld.Part1 = part1
  122. weld.C0 = c0
  123. return weld
  124. end
  125. local rayCast = function(Pos, Dir, Max, Ignore) -- Origin Position , Direction, MaxDistance , IgnoreDescendants
  126. return game:service("Workspace"):FindPartOnRay(Ray.new(Pos, Dir.unit * (Max or 999.999)), Ignore)
  127. end
  128. local rad = function(x,y,z)
  129. return euler(math.rad(x or 0),math.rad(y or 0),math.rad(z or 0))
  130. end
  131. local random = function(a, b)
  132. if a then
  133. if not b then a = 1 b = a end
  134. local num = math.random(a*100, b*100)
  135. return num/100
  136. else
  137. return math.random()
  138. end
  139. end
  140. local sound = function(id, par, vol, pit)
  141. coroutine.resume(coroutine.create(function()
  142. local sou = Instance.new("Sound", par or workspace)
  143. sou.Volume = vol
  144. sou.Pitch = pit or 1
  145. sou.SoundId = id
  146. wait()
  147. sou:play()
  148. game:GetService("Debris"):AddItem(sou, 6)
  149. end))
  150. end
  151. local damage = function(hit, minim, maxim, knockback, Type, Property, Delay, KnockbackType, incstun, stagger, staghit, ranged)
  152. if hit.Parent == nil then
  153. return
  154. end
  155. local h = hit.Parent:FindFirstChild("Humanoid")
  156. for _, v in pairs(hit.Parent:children()) do
  157. if v:IsA("Humanoid") then
  158. h = v
  159. end
  160. end
  161. if hit.Parent.Parent:FindFirstChild("Torso") ~= nil then
  162. h = hit.Parent.Parent:FindFirstChild("Humanoid")
  163. end
  164. if hit.Parent.className == "Hat" then
  165. hit = hit.Parent.Parent:findFirstChild("Head")
  166. end
  167. if h ~= nil and hit.Parent.Name ~= char.Name and hit.Parent:FindFirstChild("Torso") ~= nil then
  168. if hit.Parent:findFirstChild("DebounceHit") ~= nil then
  169. if hit.Parent.DebounceHit.Value == true then
  170. return
  171. end
  172. end
  173. local c = Instance.new("ObjectValue")
  174. c.Name = "creator"
  175. c.Value = game:service("Players").LocalPlayer
  176. c.Parent = h
  177. game:GetService("Debris"):AddItem(c, .5)
  178. local Damage = random(minim, maxim)
  179. local blocked = false
  180. local enblock = nil
  181. local Stats = hit.Parent:findFirstChild("Stats")
  182. if Stats ~= nil then
  183. enblock = Stats:findFirstChild("Block")
  184. if Stats:findFirstChild("Defense") ~= nil then
  185. Damage = Damage / Stats.Defense.Value
  186. end
  187. if Stats:findFirstChild("Stun") ~= nil then
  188. Stats.Stun.Value = Stats.Stun.Value + incstun
  189. end
  190. if Stats:findFirstChild("Stagger") ~= nil then
  191. if stagger == true then
  192. Stats.Stagger.Value = true
  193. end
  194. end
  195. end
  196. if enblock ~= nil then
  197. if enblock.Value == true then
  198. blocked = true
  199. end
  200. end
  201. if blocked == true then
  202. if ranged ~= true then
  203. enblock.Value = false
  204. end
  205. else
  206. Damage = math.floor(Damage)
  207. print("dam"..Damage)
  208. sound(sounds.hit, hit, 1, 1)
  209. h.Health = h.Health - Damage - 1000
  210. if Type == "Knockdown" then
  211. local hum = hit.Parent.Humanoid
  212. hum.PlatformStand = true
  213. coroutine.resume(coroutine.create(function(HHumanoid)
  214. wait()
  215. HHumanoid.PlatformStand = false
  216. end), hum)
  217. local angle = (hit.Position - (Property.Position + Vector3.new(0, 0, 0))).unit
  218. local bodvol = Instance.new("BodyVelocity")
  219. bodvol.velocity = angle * knockback
  220. bodvol.P = 5000
  221. bodvol.maxForce = Vector3.new(8e+003, 8e+003, 8e+003)
  222. bodvol.Parent = hit
  223. local rl = Instance.new("BodyAngularVelocity")
  224. rl.P = 3000
  225. rl.maxTorque = Vector3.new(500000, 500000, 500000) * 50000000000000
  226. rl.angularvelocity = Vector3.new(random(-10, 10), random(-10, 10), random(-10, 10))
  227. rl.Parent = hit
  228. game:GetService("Debris"):AddItem(bodvol, .5)
  229. game:GetService("Debris"):AddItem(rl, .5)
  230. elseif Type == "Knockdown2" then
  231. local hum = hit.Parent.Humanoid
  232. local angle = (hit.Position - (Property.Position + Vector3.new(0, 0, 0))).unit
  233. local bodvol = Instance.new("BodyVelocity")
  234. bodvol.velocity = angle * knockback
  235. bodvol.P = 5000
  236. bodvol.maxForce = Vector3.new(8e+003, 8e+003, 8e+003)
  237. bodvol.Parent = hit
  238. game:GetService("Debris"):AddItem(bodvol, .5)
  239. elseif Type == "Normal" or Type == "NormalDecreaseMvmt1" then
  240. local vp = Instance.new("BodyVelocity")
  241. vp.P = 500
  242. vp.maxForce = Vector3.new(math.huge, 0, math.huge)
  243. if KnockbackType == 1 then
  244. vp.velocity = Property.CFrame.lookVector * knockback + Property.Velocity / 1.05
  245. elseif KnockbackType == 2 then
  246. vp.velocity = Property.CFrame.lookVector * knockback
  247. end
  248. game:GetService("Debris"):AddItem(vp, .5)
  249. if knockback > 0 then
  250. vp.Parent = hit.Parent.Torso
  251. end
  252. end
  253. end
  254. local debounce = Instance.new("BoolValue")
  255. debounce.Name = "DebounceHit"
  256. debounce.Parent = hit.Parent
  257. debounce.Value = true
  258. game:GetService("Debris"):AddItem(debounce, Delay)
  259. c = Instance.new("ObjectValue")
  260. c.Name = "creator"
  261. c.Value = plr
  262. c.Parent = h
  263. game:GetService("Debris"):AddItem(c, .5)
  264. end
  265. end
  266. local fade = function(prt, t)
  267. coroutine.resume(coroutine.create(function()
  268. for i = 0, 1, t do
  269. wait(0)
  270. prt.Transparency = i
  271. end
  272. wait(0)
  273. prt:destroy()
  274. end))
  275. end
  276. local block1 = function(prt, delay, x, y, z, msh)
  277. coroutine.resume(coroutine.create(function()
  278. for i = 0, 1, delay do
  279. wait(0)
  280. prt.CFrame = prt.CFrame * euler(random(-50, 50), random(-50, 50), random(-50, 50))
  281. local Mesh = msh
  282. Mesh.Scale = Mesh.Scale + vt(x, y, z)
  283. prt.Transparency = i
  284. end
  285. wait(0)
  286. prt:destroy()
  287. end))
  288. end
  289. local block2 = function(prt, delay, x, y, z, msh)
  290. coroutine.resume(coroutine.create(function()
  291. for i = 0, 1, delay do
  292. wait(0)
  293. local Mesh = msh
  294. Mesh.Scale = Mesh.Scale + vt(x, y, z)
  295. prt.Transparency = i
  296. end
  297. wait(0)
  298. prt:destroy()
  299. end))
  300. end
  301. local cyleffect = function(prt, delay, x, y, z, msh)
  302. coroutine.resume(coroutine.create(function()
  303. for i = 0, 1, delay do
  304. wait(0)
  305. local Mesh = msh
  306. Mesh.Scale = Mesh.Scale + vt(x, y, z)
  307. prt.Transparency = i
  308. end
  309. wait(0)
  310. prt:destroy()
  311. end))
  312. end
  313. local CFrameFromTopBack = function(at, top, back)
  314. local right = top:Cross(back)
  315. return CFrame.new(at.x, at.y, at.z,
  316. right.x, top.x, back.x,
  317. right.y, top.y, back.y,
  318. right.z, top.z, back.z)
  319. end
  320. local triangle = function(a, b, c, col)
  321. local edg1 = (c - a):Dot((b - a).unit)
  322. local edg2 = (a - b):Dot((c - b).unit)
  323. local edg3 = (b - c):Dot((a - c).unit)
  324. if edg1 <= (b - a).magnitude and edg1 >= 0 then
  325. a, b, c = a, b, c
  326. elseif edg2 <= (c - b).magnitude and edg2 >= 0 then
  327. a, b, c = b, c, a
  328. elseif edg3 <= (a - c).magnitude and edg3 >= 0 then
  329. a, b, c = c, a, b
  330. else
  331. assert(false, "unreachable")
  332. end
  333. local len1 = (c - a):Dot((b - a).unit)
  334. local len2 = (b - a).magnitude - len1
  335. local width = (a + (b - a).unit * len1 - c).magnitude
  336. local maincf = CFrameFromTopBack(a, (b - a):Cross(c - b).unit, -(b - a).unit)
  337. local list = {}
  338. if len1 > 0.01 then
  339. local w1 = Instance.new('WedgePart')
  340. game:GetService("Debris"):AddItem(w1, 5)
  341. w1.Material = "SmoothPlastic"
  342. w1.FormFactor = 'Custom'
  343. w1.BrickColor = col
  344. w1.Transparency = 0
  345. w1.Reflectance = 0
  346. w1.Material = "SmoothPlastic"
  347. w1.CanCollide = false
  348. nolines(w1)
  349. local sz = Vector3.new(0.2, width, len1)
  350. w1.Size = sz
  351. local sp = Instance.new("SpecialMesh", w1)
  352. sp.MeshType = "Wedge"
  353. sp.Scale = Vector3.new(0, 1, 1) * sz / w1.Size
  354. w1:BreakJoints()
  355. w1.Anchored = true
  356. w1.Parent = workspace
  357. w1.Transparency = 0.7
  358. fade(w1)
  359. w1.CFrame = maincf * CFrame.Angles(math.pi, 0, math.pi / 2) * CFrame.new(0, width / 2, len1 / 2)
  360. table.insert(list, w1)
  361. end
  362. if len2 > 0.01 then
  363. local w2 = Instance.new('WedgePart', m)
  364. game:GetService("Debris"):AddItem(w2, 5)
  365. w2.Material = "SmoothPlastic"
  366. w2.FormFactor = 'Custom'
  367. w2.BrickColor = col
  368. w2.Transparency = 0
  369. w2.Reflectance = 0
  370. w2.Material = "SmoothPlastic"
  371. w2.CanCollide = false
  372. nolines(w2)
  373. local sz = Vector3.new(0.2, width, len2)
  374. w2.Size = sz
  375. local sp = Instance.new("SpecialMesh", w2)
  376. sp.MeshType = "Wedge"
  377. sp.Scale = Vector3.new(0, 1, 1) * sz / w2.Size
  378. w2:BreakJoints()
  379. w2.Anchored = true
  380. w2.Parent = workspace
  381. w2.Transparency = 0.7
  382. fade(w2)
  383. w2.CFrame = maincf * CFrame.Angles(math.pi, math.pi, -math.pi / 2) * CFrame.new(0, width / 2, -len1 - len2 / 2)
  384. table.insert(list, w2)
  385. end
  386. return unpack(list)
  387. end
  388.  
  389.  
  390. -- Magic effects
  391. local magic = {}
  392. magic.grid = function(cff,x,y,z,col)
  393. local prt = part(3, workspace, 0, 0, col, "Part", vt(1, 1, 1))
  394. prt.Anchored = true
  395. local xval = math.random()
  396. local yval = math.random()
  397. local zval = math.random()
  398. local msh = mesh("BlockMesh", prt, "", "", vt(0, 0, 0), vt(xval, yval, zval))
  399. coroutine.resume(coroutine.create(function(Part, Mesh, Frame, xvaal, yvaal, zvaal)
  400. Part.CFrame = Frame * cf(math.random(-x, x), math.random(-y, y), math.random(-z, z))
  401. for i = 1, 8 do
  402. wait()
  403. xvaal = xvaal - 0.1
  404. yvaal = yvaal - 0.1
  405. zvaal = zvaal - 0.1
  406. Mesh.Scale = vt(xvaal, yvaal, zvaal)
  407. Part.Transparency = Part.Transparency + 0.09
  408. end
  409. Part.Parent = nil
  410. end), prt, msh, cff, xval, yval, zval)
  411. end
  412. magic.stravant = function(brickcolor, cframe, x, y, z, x1, y1, z1, delay)
  413. local prt = part(3, workspace, 0, 0, brickcolor, "Effect", vt(0.5, 0.5, 0.5))
  414. prt.Anchored = true
  415. prt.CFrame = cframe * cf(x, y, z)
  416. local msh = mesh("SpecialMesh", prt, "FileMesh", "168892363", vt(0, 0, 0), vt(x1, y1, z1))
  417. game:GetService("Debris"):AddItem(prt, 5)
  418. coroutine.resume(coroutine.create(function(Part, Mesh, ex, why, zee)
  419. local num = random()
  420. local num2 = random(-3, 2) + random()
  421. local numm = 0
  422. for i = 0, 1, delay * 2 do
  423. wait()
  424. Part.CFrame = cframe * euler(0, numm * num * 10, 0) * cf(ex, why, zee) * cf(-i * 10, num2, 0)
  425. Part.Transparency = i
  426. numm = numm + 0.01
  427. end
  428. Part.Parent = nil
  429. Mesh.Parent = nil
  430. end), prt, msh, x, y, z)
  431. end
  432. magic.block = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, Type, parent)
  433. local prt = part(3, parent or workspace, 0, 0, brickcolor, "Effect", vt())
  434. prt.Anchored = true
  435. prt.CFrame = cframe
  436. local msh = mesh("BlockMesh", prt, "", "", vt(0, 0, 0), vt(x1, y1, z1))
  437. game:GetService("Debris"):AddItem(prt, 5)
  438. if Type == 1 or Type == nil then
  439. block1(prt, delay, x3, y3, z3, msh)
  440. elseif Type == 2 then
  441. block2(prt, delay, x3, y3, z3, msh)
  442. end
  443. end
  444. magic.circle = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, parent)
  445. local prt = part(3, parent or workspace, 0, 0, brickcolor, "Effect", vt())
  446. prt.Anchored = true
  447. prt.CFrame = cframe
  448. local msh = mesh("SpecialMesh", prt, "Sphere", nil, vt(0, 0, 0), vt(x1, y1, z1))
  449. game:GetService("Debris"):AddItem(prt, 2)
  450. cyleffect(prt, delay, x3, y3, z3, msh)
  451. end
  452. magic.cylinder = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, parent)
  453. local prt = part(3, parent or workspace, 0, 0, brickcolor, "Effect", vt())
  454. prt.Anchored = true
  455. prt.CFrame = cframe
  456. local msh = mesh("CylinderMesh", prt, "", "", vt(0, 0, 0), vt(x1, y1, z1))
  457. game:GetService("Debris"):AddItem(prt, 2)
  458. cyleffect(prt, delay, x3, y3, z3, msh)
  459. end
  460. magic.head = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, parent)
  461. local prt = part(3, parent or workspace, 0, 0, brickcolor, "Effect", vt())
  462. prt.Anchored = true
  463. prt.CFrame = cframe
  464. local msh = mesh("SpecialMesh", prt, "Head", nil, vt(0, 0, 0), vt(x1, y1, z1))
  465. game:GetService("Debris"):AddItem(prt, 2)
  466. cyleffect(prt, delay, x3, y3, z3, msh)
  467. end
  468. magic.wave = function(brickcolor, cframe, x1, y1, z1, x3, y3, z3, delay, parent)
  469. local prt = part(3, parent or workspace, 0, 0, brickcolor, "Effect", vt())
  470. prt.Anchored = true
  471. prt.CFrame = cframe
  472. local msh = mesh("SpecialMesh", prt, "FileMesh", "20329976", vt(0, 0, 0), vt(x1, y1, z1))
  473. game:GetService("Debris"):AddItem(prt, 5)
  474. cyleffect(prt, delay, x3, y3, z3, msh)
  475. end
  476. magic.lightning = function(p0, p1, tym, ofs, col, th, tra, last, par)
  477. local magz = (p0 - p1).magnitude
  478. local curpos = p0
  479. local trz = {
  480. -ofs,
  481. ofs
  482. }
  483. for i = 1, tym do
  484. local li = Instance.new("Part", par or workspace)
  485. li.TopSurface = 0
  486. li.BottomSurface = 0
  487. li.Anchored = true
  488. li.Transparency = tra or 0.4
  489. li.BrickColor = col
  490. li.formFactor = "Custom"
  491. li.CanCollide = false
  492. li.Size = Vector3.new(th, th, magz / tym)
  493. local ofz = Vector3.new(trz[random(1, 2)], trz[random(1, 2)], trz[random(1, 2)])
  494. local trolpos = CFrame.new(curpos, p1) * CFrame.new(0, 0, magz / tym).p + ofz
  495. if tym == i then
  496. local magz2 = (curpos - p1).magnitude
  497. li.Size = Vector3.new(th, th, magz2)
  498. li.CFrame = CFrame.new(curpos, p1) * CFrame.new(0, 0, -magz2 / 2)
  499. else
  500. li.CFrame = CFrame.new(curpos, trolpos) * CFrame.new(0, 0, magz / tym / 2)
  501. end
  502. curpos = li.CFrame * CFrame.new(0, 0, magz / tym / 2).p
  503. game.Debris:AddItem(li, last)
  504. end
  505. end
  506.  
  507.  
  508. -- M2S build
  509. local sword, SW do
  510. local char = game:GetService("Players").LocalPlayer.Character
  511. local spawnCF = char.Torso.CFrame * CFrame.new(30,5,0)
  512.  
  513. local newPart = function (class,name,mat,color,size,relcf,parent,t,r,mesh)
  514. local p = Instance.new(class)
  515. if (class ~= "CornerWedgePart" and class ~= "VehicleSeat") then p.FormFactor = Enum.FormFactor.Custom end
  516. p.Material = mat
  517. p.BrickColor = BrickColor.new(color)
  518. p.Size = size
  519. p.CFrame = relcf
  520. p.Name = name
  521. p.Transparency = t
  522. p.Reflectance = r
  523. p.Parent = parent
  524.  
  525. p.FrontSurface = "SmoothNoOutlines"
  526. p.BackSurface = "SmoothNoOutlines"
  527. p.TopSurface = "SmoothNoOutlines"
  528. p.BottomSurface = "SmoothNoOutlines"
  529. p.LeftSurface = "SmoothNoOutlines"
  530. p.RightSurface = "SmoothNoOutlines"
  531.  
  532. if (mesh) then mesh.Parent = p end
  533.  
  534. if (name ~= "MainPart") then
  535. p.CFrame = parent.MainPart.CFrame * relcf
  536. local w = Instance.new("Weld")
  537. w.C0 = relcf
  538. w.Part0 = parent.MainPart
  539. w.Part1 = p
  540. w.Parent = parent.MainPart
  541. else
  542. p.CFrame = spawnCF
  543. end
  544.  
  545. return p
  546. end
  547.  
  548. function newBlockMesh(name,scale,offset)
  549. local m = Instance.new("BlockMesh")
  550. m.Name = name
  551. m.Scale = scale
  552. m.Offset = offset
  553. return m
  554. end
  555.  
  556. function newCylinderMesh(name,scale,offset)
  557. local m = Instance.new("CylinderMesh")
  558. m.Name = name
  559. m.Scale = scale
  560. m.Offset = offset
  561. return m
  562. end
  563.  
  564. function newSpecialMesh(name,scale,offset,vcol,mtype,meshid,texid)
  565. local m = Instance.new("SpecialMesh")
  566. m.Name = name
  567. m.Scale = scale
  568. m.Offset = offset
  569. m.VertexColor = vcol
  570. m.MeshType = mtype
  571. m.MeshId = meshid
  572. m.TextureId = texid
  573. return m
  574. end
  575.  
  576. local MainGroup = Instance.new("Model")
  577. MainGroup.Name = "MainGroup"
  578. MainGroup.Parent = char
  579. sword = newPart("Part","MainPart",Enum.Material.Plastic,"Really black",Vector3.new(1, 1, 6),CFrame.new(0,0,0),MainGroup,0,0,newSpecialMesh("Mesh",Vector3.new(1.5, 1.5, 1.5),Vector3.new(0, 0, 0),Vector3.new(1, 1, 1),Enum.MeshType.FileMesh,"http://www.roblox.com/asset/?id=75347685","http://www.roblox.com/asset/?id=134368360"))
  580. sword.CanCollide = false
  581.  
  582. SW = Instance.new("Weld", torso)
  583. SW.Part0 = torso
  584. SW.Part1 = sword
  585. SW.C0 = cf(0.236126542, 0.208195135, 0.530502319, -0.778834879, 0, 0.627229035, 0.627229035, 0, 0.778834879, 0, 1, 0)
  586. end
  587.  
  588.  
  589. -- Logic variables
  590. local equipped = false
  591. local using = false
  592.  
  593. -- Pose system
  594. local poses = {}
  595. local pose = "none"
  596. local posespeed = .1
  597. local newpose = function(name, walk, torso, larm, rarm, head, lleg, rleg, sword)
  598. poses[name] = {
  599. walk = walk;
  600. torso = torso or rad();
  601. larm = rarm;
  602. rarm = larm;
  603. lleg = lleg;
  604. rleg = rleg;
  605. head = head;
  606. sword = sword;
  607. }
  608. end
  609. newpose("none",true,rad(),cf(-1.49987555, -0, -0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),cf(1.50018597, 0, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),cf(0, 1.49998784, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),cf(-0.499814987, -2.00000238, -0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),cf(0.500123978, -2.00000238, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),cf(0.236126542, 0.208195135, 0.530502319, -0.778834879, 0, 0.627229035, 0.627229035, 0, 0.778834879, 0, 1, 0))
  610. local getpose = function(name)
  611. return poses[name]
  612. end
  613. local setpose = function(name, speed)
  614. posespeed = speed or 1
  615. pose = name or "none"
  616. end
  617. local walktick = 1
  618. local walkswitch = false
  619. local heartbeat = game:GetService("RunService").Heartbeat:connect(function(dt)
  620. local vel = (RP.Velocity*Vector3.new(1,0,1)).magnitude
  621. local yvel = RP.Velocity.y
  622. local hitfloor,posfloor=rayCast(RP.Position,(CFrame.new(RP.Position,RP.Position - Vector3.new(0,1,0))).lookVector,4,char)
  623. local walking = false
  624. if yvel > 1 and hitfloor == nil and equipped and not using then
  625. setpose("jumping",.15)
  626. elseif yvel < -1 and hitfloor == nil and equipped and not using then
  627. setpose ("falling",.15)
  628. elseif vel < 1 and hitfloor ~= nil and equipped and not using then
  629. setpose("idle",.1)
  630. elseif vel > 2 and vel < 22 and hitfloor ~= nil and equipped then
  631. if not using then
  632. setpose("walking",.085)
  633. end
  634. if poses[pose].walk then
  635. walking = true
  636. end
  637. end
  638. walktick = walktick + (dt*60)
  639. if walktick >= 20 then
  640. walktick = 0
  641. walkswitch = not walkswitch
  642. walktick = 1
  643. end
  644. if poses[pose] ~= nil then
  645. local lerpInc = dt*75
  646.  
  647. local pose = poses[pose]
  648. local newlleg = pose.lleg * (walkswitch and cf(0,0,-1.15)*euler(64,0,0) or cf(0,0,1.15)*euler(-64,0,0))
  649. local newrleg = pose.rleg * (walkswitch and cf(0,0,1.15)*euler(-64,0,0) or cf(0,0,-1.15)*euler(64,0,0))
  650. RJ.C0 = RJ.C0:lerp(RJC0 * pose.torso, posespeed*lerpInc)
  651.  
  652. --LAW.C0 = LAW.C0:lerp(pose.larm, posespeed*lerpInc)
  653. --RAW.C0 = RAW.C0:lerp(pose.rarm, posespeed*lerpInc)
  654. LAW.C0 = LAW.C0:lerp(pose.rarm, posespeed*lerpInc)
  655. RAW.C0 = RAW.C0:lerp(pose.larm, posespeed*lerpInc)
  656. -- Why? I don't know, and I can't be bothered to figure it out!
  657.  
  658. LLW.C0 = LLW.C0:lerp((walking and newlleg or pose.lleg), posespeed*lerpInc)
  659. RLW.C0 = RLW.C0:lerp((walking and newrleg or pose.rleg), posespeed*lerpInc)
  660. HW.C0 = HW.C0:lerp(pose.head, posespeed*lerpInc)
  661. SW.C0 = SW.C0:lerp(pose.sword, posespeed*lerpInc)
  662. end
  663. end)
  664.  
  665.  
  666. -- Weapon setup
  667. local bin = Instance.new("HopperBin",backpack)
  668. bin.Name = "Descent"
  669. script.Parent = bin
  670.  
  671.  
  672. --[[
  673.  
  674. Pose making
  675.  
  676. USAGE
  677. newpose(nameOfPose, enableWalkingAnim leftArmRotation, rightArmRotation, torsoRotation, headRotation, leftLegRotation, rightLegRotation swordRotation)
  678. setpose(nameOfPose, speed)
  679.  
  680. NOTES
  681. speed is lerp alpha, must be between 0 and 1
  682. anything higher than .2 starts to get way too fast
  683.  
  684. ]]
  685.  
  686. -- Weapon poses
  687. newpose("equipping",true,rad(),cf(-1.64987671, -2.85121672e-007, 6.28829002e-006, 0.983557284, 0.178399742, -0.0280837137, -0.17847012, 0.98394537, -1.00781517e-006, 0.0276326574, 0.00501309615, 0.999605596),cf(1.59018254, 0.77999872, 0.400001705, -0.956045926, -0.217928261, -0.196168616, 0.274051368, -0.902024806, -0.333533794, -0.10426265, -0.372634739, 0.922102571),cf(2.08616257e-007, 1.49998772, -8.64267349e-007, 0.922784925, -0.043397408, -0.382863909, 1.06278307e-007, 0.993637085, -0.112627991, 0.385315657, 0.103931367, 0.91691339),cf(-0.499814987, -2.00000238, -0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),cf(0.500123978, -2.00000238, 0, 1, 0, 0, 0, 0.999999881, 0, 0, 0, 1),cf(0.236126542, 0.208195135, 0.530502319, -0.778834879, 0, 0.627229035, 0.627229035, 0, 0.778834879, 0, 1, 0))
  688. newpose("idle",true,rad(),cf(-0.756638229, 0.0599996597, -0.65332669, 0.994853199, -0.0165869668, -0.0999603048, -0.0847867355, 0.403909385, -0.910861373, 0.0554833338, 0.914648652, 0.400424123),cf(0.453012466, 0.0399968475, -1.11585271, 0.664649546, 0.652857542, 0.36334303, 0.0236363281, 0.467685938, -0.883578718, -0.746781409, 0.595858216, 0.295416057),cf(1.68383121e-006, 1.49998808, -0.00999847054, 0.990724266, -0.0563919544, 0.123634346, 0.0384039208, 0.988930166, 0.14332597, -0.130348161, -0.137248456, 0.981922805),cf(-0.56342864, -2.00000286, 0.343433022, 0.997149706, 0.0485906191, 0.0577187128, -0.0557807721, 0.989901781, 0.130318925, -0.0508035831, -0.133167073, 0.989790618),cf(0.503640592, -2.00000286, -0.273655891, 0.999014914, -0.0372821577, 0.024070533, 0.0351201855, 0.995785117, 0.0847271904, -0.0271278918, -0.0837983638, 0.99611342),cf(-0.737918079, 1.03819513, -2.30186415, 0.37132141, -0.91125077, 0.17816402, 0.519117236, 0.0446528532, -0.853535831, 0.76982969, 0.409424126, 0.489626527))
  689. newpose("jumping",true,rad(-5,0,0),cf(-0.946639121, 0.0299969912, -0.653327823, 0.994324327, -0.0883254707, -0.0593115017, 0.0300430115, 0.767891884, -0.639874518, 0.102062039, 0.634460866, 0.766187131),cf(0.403011978, -0.0600040704, -0.895852208, 0.493396819, 0.629597247, 0.600139141, -0.0772109702, 0.718949199, -0.690760911, -0.866370678, 0.294481933, 0.403338999),cf(-1.24564394e-007, 1.49998474, 0.0299979448, 0.999961138, 0.00797112565, -0.00378393754, -0.0085750008, 0.978978217, -0.203784525, 0.00208000024, 0.203809038, 0.979008496),cf(-0.443426937, -2.00000429, 0.153407246, 0.998627484, -0.0213356148, 0.0478327721, 0.00566600263, 0.951916099, 0.306306511, -0.0520680249, -0.305615067, 0.950730443),cf(0.503641069, -1.68000412, -0.213666171, 0.999014854, -0.0403042547, 0.0185717344, 0.0351199955, 0.973880887, 0.224327207, -0.0271279961, -0.223453969, 0.974336922),cf(-1.82791996, -0.0718066096, -2.14186811, -0.307601988, -0.331120163, 0.892042875, 0.304724991, -0.922402322, -0.237311438, 0.901400983, 0.198830277, 0.384633362))
  690. newpose("falling",true,rad(10,0,0),cf(-0.666639209, 0.0599967986, -0.563327968, 0.985662341, -0.118955307, -0.119664162, -0.0245540086, 0.600531936, -0.799223661, 0.166934058, 0.79070282, 0.589000881),cf(0.403012127, -0.0600042567, -0.895852089, 0.493396819, 0.679638982, 0.542817235, -0.0772109702, 0.655826986, -0.750952363, -0.866370678, 0.328606069, 0.376058459),cf(-1.48160325e-007, 1.49998534, -0.1100021, 0.999961138, 0.00880661979, -0.000548160984, -0.0085750008, 0.98454833, 0.174903557, 0.00208000024, -0.174892053, 0.984585464),cf(-0.443426996, -2.00000429, -0.326593041, 0.998627484, 0.0118473442, 0.051017873, 0.00566600263, 0.943927228, -0.330105036, -0.0520680249, 0.329941064, 0.942564547),cf(0.503641129, -1.71000409, -0.0836663842, 0.999014854, -0.0407369211, 0.0176024325, 0.0351199955, 0.968236864, 0.247556016, -0.0271279961, -0.246693969, 0.968713641),cf(-1.20792031, 0.678192794, -1.93186831, 0.145138994, -0.795116782, 0.588832796, 0.398281008, -0.49783498, -0.770410657, 0.905708015, 0.346337527, 0.244424611))
  691. newpose("walking",true,rad(15,0,0),cf(-0.946638227, 0.0299995244, -0.65332818, 0.993961215, -0.0423426107, -0.101233616, -0.0573373511, 0.586183429, -0.808146954, 0.0935605168, 0.809071183, 0.580215752),cf(0.403011918, -0.0600015298, -1.1158483, 0.435567051, 0.778061748, 0.452660352, -0.119193166, 0.548292816, -0.827748835, -0.892230093, 0.306586057, 0.3315579),cf(-4.93840162e-007, 1.49998796, -0.0800009891, 0.999961138, 0.00868245587, -0.00157543737, -0.00857548602, 0.998251975, 0.0584768988, 0.00208040653, -0.058461111, 0.998287559),cf(-0.443427354, -2.00000334, 0.0234032478, 0.998627484, -0.0061187488, 0.0520171858, 0.00566584058, 0.999944866, 0.00884989742, -0.0520684645, -0.00854302943, 0.99860698),cf(0.50364089, -2.00000381, 0.0463338569, 0.999014914, -0.0362941064, 0.0255364571, 0.0351201631, 0.998369157, 0.0450083017, -0.0271283463, -0.0440671183, 0.998660207),cf(-1.82791972, 0.54819423, -2.14186907, -0.0421415642, -0.671723962, 0.73960191, 0.458628416, -0.670665264, -0.582982063, 0.887628317, 0.314634681, 0.336334616))
  692.  
  693. -- Attack poses
  694. newpose("clickattack1_1",true,rad(0,0,45),cf(-0.94663918, 0.340000004, -0.763327897, 0.994315445, 0.0909560397, -0.0553537421, -0.0529500246, -0.0286330078, -0.998186588, -0.0923760459, 0.995443225, -0.0236541145),cf(0.143012077, 0.280000031, -1.11585188, 0.428441077, 0.892365396, -0.141853005, -0.124199033, -0.0973410457, -0.987471223, -0.894993246, 0.440691203, 0.0691260174),cf(7.4505806e-009, 1.49998653, -0.130001888, 0.837803185, 0.00882007554, -0.545901239, 0.108222023, 0.977347136, 0.181880966, 0.535139143, -0.211458981, 0.817869961),cf(-0.443427026, -2.00000048, 0.0234071016, 0.990320146, -0.00611765496, -0.138667256, 0.0072430009, 0.999944866, 0.00761226891, 0.138613015, -0.00854295027, 0.990309834),cf(0.50364095, -2, 0.0463339239, 0.892211854, -0.0362951159, -0.450156212, 0.0522359908, 0.998369098, 0.0230356771, 0.448585927, -0.0440670587, 0.89265269),cf(-1.74792004, 1.48819625, -1.01186812, 0.198280096, -0.761572957, 0.617002189, -0.6179533, -0.585759163, -0.52442348, 0.760801375, -0.277295828, -0.586760819))
  695. newpose("clickattack1_2",true,rad(),cf(-0.0566394739, 0.339999884, -1.01332808, 0.595662236, -0.8013255, -0.0553532578, -0.052028019, 0.0302770287, -0.998186529, 0.801548302, 0.597461998, -0.0236564931),cf(1.62301266, 0.28000012, -0.835852087, 0.541691124, -0.828521013, -0.141858652, -0.0189870037, 0.15666002, -0.98747015, 0.840363204, 0.537597239, 0.0691302046),cf(2.98023224e-008, 1.49998617, -0.270001799, 0.981241643, 0.0142296506, -0.192256331, 0.0802309737, 0.876662135, 0.474369645, 0.175293937, -0.480896115, 0.859075725),cf(-0.443427056, -2, 0.023407124, 0.99495101, -0.00611682702, 0.100175783, 0.00522999978, 0.999944866, 0.00911294669, -0.100226, -0.00854301639, 0.994928002),cf(0.50364095, -2, 0.0463340282, 0.989129663, -0.0832518339, 0.121209346, 0.0296009891, 0.920151889, 0.390441149, -0.14403595, -0.38260898, 0.912613869),cf(3.262079, 0.148196459, -2.15186763, -0.834534585, -0.012126239, -0.550822139, -0.0781299621, -0.987049758, 0.140102118, -0.545387745, 0.159955785, 0.822779655))
  696. newpose("clickattack2_1",true,rad(0,0,90),cf(-1.76663959, 0.0300002098, 0.286672145, 0.413701922, 0.900140464, -0.13637431, -0.58393085, 0.377275139, 0.71881026, 0.698480844, -0.217740059, 0.681699157),cf(1.91301227, 0.279999882, 0.0141478404, 0.0494749881, -0.988649666, -0.141859591, 0.0626789853, 0.144826919, -0.987469792, 0.996806741, 0.0399634428, 0.0691328645),cf(9.87201929e-008, 1.49998629, 0.129998043, -0.0508020073, 0.0242319945, -0.998414814, 0.0368390046, 0.999070764, 0.0223734509, 0.998029113, -0.0356439911, -0.0516474806),cf(-0.443427086, -2.00000024, 0.0234070867, 0.902443111, -0.00611780258, -0.430765867, 0.00920100044, 0.999944866, 0.00507447962, 0.430711061, -0.00854290463, 0.902449489),cf(0.503641129, -2, -0.123666018, 0.733109653, 0.107207075, -0.671607673, 0.041144982, 0.978698015, 0.201139957, 0.678864717, -0.175090924, 0.713081956),cf(4.19207954, 0.0381964743, -0.191868365, 0.0566840172, -0.0928049609, -0.994069576, 0.99066937, -0.118373886, 0.0675413609, -0.123940043, -0.988622665, 0.085229136))
  697. newpose("clickattack2_2",true,rad(0,0,90),cf(-1.86663961, 0.0700006559, 0.0666723996, 0.698318958, 0.71342653, 0.0580799505, -0.713955939, 0.70003581, -0.0147246355, -0.0511629917, -0.0311840307, 0.998203337),cf(1.72301257, 0.549999893, 0.0141478181, 0.0331249982, -0.454647064, 0.890055478, 0.0650660023, -0.887674093, -0.455852121, 0.997331023, 0.0730124563, 0.000177863083),cf(-2.98023224e-008, 1.49998581, 0.00999807473, 0.0432000011, 0.226003945, -0.973168015, 0.0345759988, 0.973155618, 0.227535948, 0.998467982, -0.0434778035, 0.0342260115),cf(-1.11342716, -1.82000005, 0.0234071054, 0.195758089, 0.435832828, -0.878480792, 0.011703006, 0.894710779, 0.446492672, 0.980582476, -0.0976854116, 0.170046285),cf(0.50364095, -2.00000024, -0.123665966, 0.0461530052, -0.0240169745, -0.998645604, 0.036588002, 0.999080777, -0.0223365016, 0.998264134, -0.0355075523, 0.0469893068),cf(3.23208094, -0.311803937, -0.191868246, 0.851349711, -0.148348719, -0.503186226, 0.505451798, -0.0248128437, 0.862498045, -0.140435949, -0.988623798, 0.0538587123))
  698.  
  699. -- Ability poses
  700. newpose("skyward",true,rad(0,0,0),cf(-1.78663909, 0.199999273, -0.0333281085, 0.886879444, 0.45126012, -0.0990417823, -0.460134208, 0.882012665, -0.10163781, 0.0414910167, 0.135712981, 0.989879072),cf(1.36301219, 1.219998, -0.325852513, 0.995975733, 0.0823964253, -0.0352603458, 0.0617309846, -0.91590631, -0.396616906, -0.064974986, 0.392844111, -0.9173069),cf(-4.21423465e-008, 1.49998474, 0.13999784, 0.999961138, 0.00636417232, -0.00611181976, -0.0085750008, 0.864189684, -0.503093064, 0.00208000024, 0.503125846, 0.864210665),cf(-0.733426809, -2.00000095, 0.0234069452, 0.980584145, 0.189074591, 0.0520153716, -0.189776033, 0.981787503, 0.00884856097, -0.0493950062, -0.0185480267, 0.998607099),cf(0.663641095, -2.00000167, 0.0463340357, 0.985348225, -0.168632373, 0.0255379006, 0.167383045, 0.984864175, 0.0450070426, -0.0327410065, -0.0400729999, 0.998660207),cf(1.30208063, 3.04819703, -0.341867983, -0.0297929998, -0.999109626, 0.0298743155, -0.258697003, -0.0211619101, -0.965726674, 0.965498984, -0.03650029, -0.257836163))
  701. newpose("forward",true,rad(0,0,52),cf(-1.55663896, 0.199998945, 0.286672145, 0.855996132, 0.509136617, 0.0897251144, -0.51542908, 0.827029824, 0.22439824, 0.0400440022, -0.23833093, 0.970358193),cf(1.58301163, 0.469996452, -0.765852094, 0.657042027, -0.753853858, -0.000418484764, 0.0695260018, 0.061150033, -0.995704174, 0.750640988, 0.654190361, 0.0925905854),cf(7.07805157e-008, 1.49998522, 0.139998019, 0.690484822, -0.0170700457, -0.723145425, -0.0346029922, 0.997797549, -0.0565934367, 0.722518802, 0.0640999079, 0.688373327),cf(-0.733426988, -2.00000143, 0.353406817, 0.969849885, 0.207619444, -0.127614543, -0.183750987, 0.966961205, 0.176696703, 0.160083979, -0.147919968, 0.975957394),cf(0.663641036, -2.00000119, 0.0463339537, 0.589267015, -0.168631271, -0.790144205, 0.133318007, 0.984864414, -0.110763341, 0.796863019, -0.0400712751, 0.602829695),cf(3.12208652, 0.508194387, -2.15186763, -0.0138110016, -0.663701713, -0.747869849, 0.999798119, -0.0200850219, -0.000638812606, -0.0145970015, -0.747727633, 0.663845122))
  702. newpose("praying",true,rad(),cf(-0.606637776, 0.029999882, -0.973328352, 0.877891243, -0.468036532, -0.101236679, 0.20180504, 0.553326726, -0.808148742, 0.4342601, 0.689036548, 0.580212831),cf(0.613015056, -0.0400024205, -1.0258534, 0.791316688, 0.564337909, 0.235246092, -0.0998699591, 0.49890101, -0.860885501, -0.603194773, 0.657739043, 0.451149046),cf(5.18397428e-007, 1.49998343, -0.230001897, 0.999961138, 0.0084068235, 0.00268076966, -0.0085750008, 0.854174197, 0.519916356, 0.00208100025, -0.519919097, 0.854212999),cf(-0.443426222, -2.00000429, 0.0234068967, 0.998627484, -0.0061187488, 0.0520171858, 0.00566584058, 0.999944866, 0.00884989742, -0.0520684645, -0.00854302943, 0.99860698),cf(0.503642797, -2.00000405, 0.0463329852, 0.999014914, -0.0362941064, 0.0255364571, 0.0351201631, 0.998369157, 0.0450083017, -0.0271283463, -0.0440671183, 0.998660207),cf(-0.00791849662, 0.828193307, -1.68186915, -0.999248743, 0.0366873257, -0.012494361, 0.011835997, -0.0181079991, -0.999765992, -0.0369049907, -0.999162734, 0.0176601633))
  703.  
  704. -- Breathing animation
  705. --[[coroutine.resume(coroutine.create(function()
  706. newpose("idlebreath", rad(0,0,0), rad(0,0,0), rad(0,0,0), rad(0,0,0), rad(0,0,0), rad(0,0,0))
  707. local speed = .0075
  708. local state1 = getpose("idle")
  709. local state2 = getpose("idlebreath")
  710. while true do
  711. for i = 0, 1, speed do
  712. newpose("idle",
  713. state1.larm:lerp(state2.larm, i),
  714. state1.rarm:lerp(state2.rarm, i),
  715. state1.torso:lerp(state2.torso, i),
  716. state1.head:lerp(state2.head, i),
  717. state1.lleg:lerp(state2.lleg, i),
  718. state1.rleg:lerp(state2.rleg, i)
  719. )
  720. wait()
  721. end
  722. for i = 0, 1, speed do
  723. newpose("idle",
  724. state2.larm:lerp(state1.larm, i),
  725. state2.rarm:lerp(state1.rarm, i),
  726. state2.torso:lerp(state1.torso, i),
  727. state2.head:lerp(state1.head, i),
  728. state2.lleg:lerp(state1.lleg, i),
  729. state2.rleg:lerp(state1.rleg, i)
  730. )
  731. wait()
  732. end
  733. end
  734. end))]]
  735.  
  736. -- Weapon usage (edit to liking)
  737. local equip = function()
  738. equipped = true
  739. if using then
  740. repeat
  741. wait()
  742. until not using
  743. end
  744. using = true
  745. if not equipped then
  746. using = false
  747. return
  748. end
  749. LS.Part1 = nil
  750. LAW.Part1 = larm
  751. RS.Part1 = nil
  752. RAW.Part1 = rarm
  753. LH.Part1 = nil
  754. LLW.Part1 = lleg
  755. RH.Part1 = nil
  756. RLW.Part1 = rleg
  757. neck.Part1 = nil
  758. HW.Part1 = head
  759. setpose("equipping", .125)
  760. wait(.3)
  761. if not equipped then
  762. using = false
  763. return
  764. end
  765. setpose("idle", .085)
  766. using = false
  767. end
  768. local unequip = function()
  769. equipped = false
  770. if using then
  771. repeat
  772. wait()
  773. until not using
  774. end
  775. if equipped then
  776. return
  777. end
  778. setpose("none", .1)
  779. wait(.65)
  780. if equipped then
  781. return
  782. end
  783. LAW.Part1 = nil
  784. LS.Part1 = larm
  785. RAW.Part1 = nil
  786. RS.Part1 = rarm
  787. LLW.Part1 = nil
  788. LH.Part1 = lleg
  789. RLW.Part1 = nil
  790. RH.Part1 = rleg
  791. HW.Part1 = nil
  792. neck.Part1 = head
  793. end
  794. local combo = 0
  795. local clicked = function(hit)
  796. if using or not equipped then
  797. return
  798. end
  799. if combo == 0 then
  800. using = true
  801. combo = combo + 1
  802. setpose("clickattack1_1", .075)
  803. wait(.5)
  804. local dam = sword.Touched:connect(function(hit)
  805. damage(hit, 30, 90, random(2, 5), "Normal", RP, .5, 1, random(3, 10), nil, true)
  806. end)
  807. setpose("clickattack1_2", .14)
  808. sound(sounds.slice,torso,.7,.5)
  809. wait(.4)
  810. dam:disconnect()
  811. using = false
  812. wait(.3)
  813. if combo == 1 then
  814. combo = 0
  815. end
  816. end
  817. end
  818. local pressed = function(key)
  819. if using or not equipped then
  820. return
  821. end
  822. if key == "z" then
  823. using = true
  824. setpose("clickattack1_1",.15)
  825. wait(.15)
  826. local dam = sword.Touched:connect(function(hit)
  827. damage(hit, 10, 40, random(2, 5), "Normal", RP, .5, 1, random(3, 10), nil, true)
  828. end)
  829. setpose("clickattack2_1", .15)
  830. sound(sounds.slice,torso,1,1)
  831. wait(.35)
  832. dam:disconnect()
  833. using = false
  834. elseif key == "x" then
  835. using = true
  836. hum.WalkSpeed = 0
  837. local dam = sword.Touched:connect(function(hit)
  838. damage(hit, 10, 40, random(2, 5), "Normal", RP, .5, 1, random(3, 10), nil, true)
  839. end)
  840. setpose("clickattack2_1", .1)
  841. sound(sounds.metalhit,torso,.75,1)
  842. wait(.4)
  843. dam:disconnect()
  844. setpose("clickattack2_2", .14)
  845. sound(sounds.metalhit,torso,.75,.8)
  846. for i = 1, 2 do
  847. magic.block(BrickColor.new("Really black"), rarm.CFrame*cf(0,-1,0), 1, 2, 1, .5, 1, .5, .065)
  848. wait(.1)
  849. end
  850. coroutine.resume(coroutine.create(function()
  851. local bewmcf = torso.CFrame*cf(4.5,-2.5,0)
  852. for i = 1, 3 do
  853. for _,v in next,game.Workspace:GetChildren() do
  854. if v:FindFirstChild("Torso") and v.Torso:IsA("BasePart") then
  855. if (v.Torso.Position - bewmcf.p).magnitude <= 5 then
  856. damage(v.Torso,15,30, random(2, 5), "Normal", RP, .5, 1, random(3, 10), nil, true)
  857. end
  858. end
  859. end
  860. for i = 1, 3 do
  861. magic.block(BrickColor.new("Really black"), bewmcf, 3, 3, 3, 2, 2, 2, .075)
  862. end
  863. sound(sounds.bewm,torso,.75,.8)
  864. bewmcf = bewmcf*cf(5,0,0)
  865. wait(.3)
  866. end
  867. end))
  868. for i = 1, 2 do
  869. magic.block(BrickColor.new("Really black"), rarm.CFrame*cf(0,-1,0), 1, 2, 1, .5, 1, .5, .065)
  870. wait(.1)
  871. end
  872. hum.WalkSpeed = wspeed
  873. using = false
  874. elseif key == "c" then
  875. using = true
  876. hum.WalkSpeed = 0
  877. setpose("praying",.1)
  878. sound(sounds.heal,torso,.5,.8)
  879. for i = 1, 20 do
  880. wait(.1)
  881. local randpos = CFrame.new(torso.CFrame.p + Vector3.new(math.random(-2,2),-3,math.random(-2,2)))
  882. magic.circle(BrickColor.new("Really black"), randpos, 4, .5, 4, 0, 8, 0, .15)
  883. for i = 1, 2 do
  884. magic.block(BrickColor.new("Really black"), sword.CFrame*cf(0,0,-4), 1, 2, 1, .5, 1, .5, .075)
  885. end
  886. hum.Health = hum.Health + 1
  887. end
  888. hum.WalkSpeed = wspeed
  889. using = false
  890. elseif key == "v" then
  891. using = true
  892. hum.WalkSpeed = 0
  893. setpose("skyward", .1)
  894. sound(sounds.chargepulse,torso,.8,.75)
  895. for i = 1, 10 do
  896. for i = 1, 2 do
  897. magic.block(BrickColor.new("Really black"), sword.CFrame*cf(0,0,-4), 1, 2, 1, .5, 1, .5, .065)
  898. end
  899. for i = 1, 3 do
  900. magic.grid(torso.CFrame,5,5,5,BrickColor.new("Really black"))
  901. end
  902. wait(.1)
  903. end
  904. setpose("forward",.155)
  905. for i = 1, 5 do
  906. for i = 1, 3 do
  907. magic.block(BrickColor.new("Really black"), sword.CFrame*cf(0,0,-4), 1, 2, 1, .5, 1, .5, .065)
  908. end
  909. wait(.055)
  910. end
  911. local bewmcf = sword.CFrame*cf(0,0,-4)
  912. sound(sounds.explosion,torso,1,1)
  913. coroutine.resume(coroutine.create(function()
  914. for i = 1, 20 do
  915. for _,v in next,game.Workspace:GetChildren() do
  916. if v:FindFirstChild("Torso") and v.Torso:IsA("BasePart") then
  917. if (v.Torso.Position - bewmcf.p).magnitude <= 7.5 then
  918. damage(v.Torso,30,90, random(2, 5), "Normal", RP, .5, 1, random(3, 10), nil, true)
  919. end
  920. end
  921. end
  922. for i = 1, 2 do
  923. magic.block(BrickColor.new("Really black"), bewmcf, 2, 2, 2, 3, 3, 3, .075)
  924. end
  925. sound(sounds.bewm,torso,.5,.5)
  926. bewmcf = bewmcf*cf(0,0,-5)
  927. wait(.1)
  928. end
  929. end))
  930. wait(.75)
  931. hum.WalkSpeed = wspeed
  932. using = false
  933. end
  934. end
  935. hum.WalkSpeed = wspeed
  936. local selected = bin.Selected:connect(equip)
  937. local deselected = bin.Deselected:connect(unequip)
  938. local button1down = mouse.Button1Down:connect(clicked)
  939. local keydown = mouse.KeyDown:connect(pressed)
  940. char.Changed:connect(function(prop, val)
  941. if prop == "Parent" and val == nil then
  942. heartbeat:disconnect()
  943. selected:disconnect()
  944. deselected:disconnect()
  945. button1down:disconnect()
  946. keydown:disconnect()
  947. end
  948. end)
Advertisement
Add Comment
Please, Sign In to add comment