Advertisement
memberhero

Untitled

Aug 7th, 2016
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.89 KB | None | 0 0
  1. for i,v in pairs(script:GetChildren()) do
  2. pcall(function() v.Value = "" end)
  3. v:Destroy()
  4. end
  5. function weld(p0,p1,c0,c1,par)
  6. local w = Instance.new("Weld",p0 or par)
  7. w.Part0 = p0
  8. w.Part1 = p1
  9. w.C0 = c0 or CFrame.new()
  10. w.C1 = c1 or CFrame.new()
  11. return w
  12. end
  13. function lerp(a,b,c)
  14. return a+(b-a)*c
  15. end
  16. --[[
  17. function clerp(c1,c2,al)
  18. local com1 = {c1:components()}
  19. local com2 = {c2:components()}
  20. for i,v in pairs(com1) do
  21. com1[i] = lerp(v,com2[i],al)
  22. end
  23. return CFrame.new(unpack(com1))
  24. end]]
  25. do
  26. local function QuaternionFromCFrame(cf) local mx, my, mz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cf:components() local trace = m00 + m11 + m22 if trace > 0 then local s = math.sqrt(1 + trace) local recip = 0.5/s return (m21-m12)*recip, (m02-m20)*recip, (m10-m01)*recip, s*0.5 else local i = 0 if m11 > m00 then i = 1 end if m22 > (i == 0 and m00 or m11) then i = 2 end if i == 0 then local s = math.sqrt(m00-m11-m22+1) local recip = 0.5/s return 0.5*s, (m10+m01)*recip, (m20+m02)*recip, (m21-m12)*recip elseif i == 1 then local s = math.sqrt(m11-m22-m00+1) local recip = 0.5/s return (m01+m10)*recip, 0.5*s, (m21+m12)*recip, (m02-m20)*recip elseif i == 2 then local s = math.sqrt(m22-m00-m11+1) local recip = 0.5/s return (m02+m20)*recip, (m12+m21)*recip, 0.5*s, (m10-m01)*recip end end end
  27.  
  28. local function QuaternionToCFrame(px, py, pz, x, y, z, w) local xs, ys, zs = x + x, y + y, z + z local wx, wy, wz = w*xs, w*ys, w*zs local xx = x*xs local xy = x*ys local xz = x*zs local yy = y*ys local yz = y*zs local zz = z*zs return CFrame.new(px, py, pz,1-(yy+zz), xy - wz, xz + wy,xy + wz, 1-(xx+zz), yz - wx, xz - wy, yz + wx, 1-(xx+yy)) end
  29.  
  30. local function QuaternionSlerp(a, b, t) local cosTheta = a[1]*b[1] + a[2]*b[2] + a[3]*b[3] + a[4]*b[4] local startInterp, finishInterp; if cosTheta >= 0.0001 then if (1 - cosTheta) > 0.0001 then local theta = math.acos(cosTheta) local invSinTheta = 1/math.sin(theta) startInterp = math.sin((1-t)*theta)*invSinTheta finishInterp = math.sin(t*theta)*invSinTheta else startInterp = 1-t finishInterp = t end else if (1+cosTheta) > 0.0001 then local theta = math.acos(-cosTheta) local invSinTheta = 1/math.sin(theta) startInterp = math.sin((t-1)*theta)*invSinTheta finishInterp = math.sin(t*theta)*invSinTheta else startInterp = t-1 finishInterp = t end end return a[1]*startInterp + b[1]*finishInterp, a[2]*startInterp + b[2]*finishInterp, a[3]*startInterp + b[3]*finishInterp, a[4]*startInterp + b[4]*finishInterp end
  31. function clerp(a,b,t)
  32. local qa = {QuaternionFromCFrame(a)}
  33. local qb = {QuaternionFromCFrame(b)}
  34. local ax, ay, az = a.x, a.y, a.z
  35. local bx, by, bz = b.x, b.y, b.z
  36. local _t = 1-t
  37. return QuaternionToCFrame(_t*ax + t*bx, _t*ay + t*by, _t*az + t*bz,QuaternionSlerp(qa, qb, t))
  38. end
  39. end
  40. function tickwave(time,length,offset)
  41. return (math.abs((tick()+(offset or 0))%time-time/2)*2-time/2)/time/2*length
  42. end
  43. function invcol(c)
  44. c = c.Color
  45. return BrickColor.new(Color3.new(1-c.r,1-c.g,1-c.b))
  46. end
  47. function playSound(id,parent,volume,pitch)
  48. local sound = Instance.new("Sound",parent or workspace)
  49. sound.SoundId = type(id) == "string" and id or "rbxassetid://"..id
  50. sound.Volume = volume or 1
  51. sound.Pitch = pitch or 1
  52. Spawn(function()
  53. wait(1/30)
  54. sound:Play()
  55. wait(10)
  56. sound:Stop()
  57. sound:Destroy()
  58. end)
  59. end
  60. local oc = oc or function(...) return ... end
  61. local players = game:GetService("Players")
  62. local debris = game:GetService("Debris")
  63. local run = game:GetService("RunService")
  64. local plr = players.LocalPlayer
  65. local mouse = plr:GetMouse()
  66. local char = plr.Character
  67. local mpar = char
  68. local name = "DSwords"
  69. pcall(function() plr.Backpack[name]:Destroy() end)
  70. pcall(function() mpar[name]:Destroy() end)
  71. pcall(function() workspace.CurrentCamera[name]:Destroy() end)
  72. wait(.05)
  73. local tor,ra,la,rl,ll,hd,hum = char.Torso,char["Right Arm"],char["Left Arm"],char["Right Leg"],char["Left Leg"],char.Head,char.Humanoid
  74. local basewalk = 22
  75. local rrs,rls,nk = tor["Right Shoulder"],tor["Left Shoulder"],tor.Neck
  76. local nk0 = nk.C0
  77. local rc0,rc1 = rrs.C0,rrs.C1
  78. local lc0,lc1 = rls.C0,rls.C0
  79. local rs,ls = rrs:Clone(),rls:Clone()
  80. rs.Name,ls.Name = "rs","ls"
  81. local bin = Instance.new("HopperBin",plr.Backpack)
  82. bin.Name = name
  83. local model = Instance.new("Model",mpar)
  84. local t = {}
  85. local cmodel = Instance.new("Model",workspace.CurrentCamera)
  86. cmodel.Name = name
  87. model.ChildAdded:connect(function(c)
  88. wait(.05)
  89. local b = c:Clone()
  90. b.Parent = cmodel
  91. b:BreakJoints()
  92. if not b.Anchored then
  93. weld(c,b)
  94. end
  95. t[c] = {b,c.Changed:connect(function(o)
  96. if o == "Transparency" or o == "Reflectance" or o == "BrickColor" then
  97. b[o] = c[o]
  98. end
  99. end)}
  100. end)
  101. model.ChildRemoved:connect(function(c)
  102. ypcall(function()
  103. t[c][2]:disconnect()
  104. t[c][1]:Destroy()
  105. end)
  106. end)
  107. model.Name = name
  108. char.archivable = true
  109. local fpa = char:Clone()
  110. fpa:BreakJoints()
  111. fpa.Humanoid.Health = 0
  112. char.archivable = false
  113. wait(.05)
  114. fpa.Name = ""
  115. for i,v in pairs(fpa:GetChildren()) do
  116. if v:IsA("BasePart") then
  117. v:BreakJoints()
  118. v.Anchored = true
  119. v.CFrame = CFrame.new(10000,10000,0)
  120. elseif v:IsA("Script") or v:IsA("Hat") then
  121. v:Destroy()
  122. end
  123. end
  124. fpa.Parent = workspace.CurrentCamera
  125. fpa:BreakJoints()
  126. local fra,fla = fpa["Right Arm"],fpa["Left Arm"]
  127. fra.Anchored = false
  128. fla.Anchored = false
  129. weld(ra,fra)
  130. weld(la,fla)
  131. local part = Instance.new("Part")
  132. part.FormFactor = "Custom"
  133. part.TopSurface,part.BottomSurface = 0,0
  134. part.Size = Vector3.new(.2,.2,.2)
  135. part:BreakJoints()
  136. part.CanCollide = false
  137. function clone(t)
  138. local p = t:Clone()
  139. p.Parent = t.Parent or model
  140. return p
  141. end
  142. local cons = {}
  143. function con(a)
  144. if runend then pcall(function() a:disconnect() end) return end
  145. table.insert(cons,a)
  146. return a
  147. end
  148. local slen = 4.5
  149. local r_gem = clone(part)
  150. r_gem.Size = Vector3.new(.3,.3,.2)
  151. r_gem.BrickColor = BrickColor.Red()
  152. local m = Instance.new("BlockMesh",r_gem)
  153. m.Scale = Vector3.new(1,1,.5)
  154. weld(ra,r_gem,CFrame.new(0,-.6,-.5))
  155. local r_a1 = clone(part)
  156. r_a1.Size = Vector3.new(.2,.5,.2)
  157. r_a1.BrickColor = BrickColor.new("Dark stone grey")
  158. r_a1.Reflectance = .2
  159. local m = Instance.new("BlockMesh",r_a1)
  160. m.Scale = Vector3.new(.25,.8,.25)
  161. weld(r_gem,r_a1,CFrame.new(.05,-.275,0))
  162. local r_a2 = clone(r_a1)
  163. weld(r_gem,r_a2,CFrame.new(-.05,-.275,0))
  164. local r_b1 = clone(r_a1)
  165. r_b1.Size = Vector3.new(.2,.6,1)
  166. local m = r_b1.Mesh
  167. m.Scale = Vector3.new(.75,.25,1)
  168. weld(r_gem,r_b1,CFrame.new(0,-.475,.475))
  169. local r_bl1 = clone(part)
  170. r_bl1.Transparency = .5
  171. r_bl1.Size = Vector3.new(.2,5.8,.5)
  172. local m = Instance.new("SpecialMesh",r_bl1)
  173. m.MeshId = "rbxassetid://70988954"
  174. m.TextureId = "rbxassetid://103972499"
  175. m.VertexColor = Vector3.new(1,1,1)*1
  176. m.Scale = Vector3.new(1,1,1)*.675
  177. weld(r_gem,r_bl1,CFrame.new(0,-.19,-1.5)*CFrame.Angles(math.rad(-90),0,0))
  178. local l_gem = clone(part)
  179. l_gem.Size = Vector3.new(.3,.3,.2)
  180. l_gem.BrickColor = BrickColor.Red()
  181. local m = Instance.new("BlockMesh",l_gem)
  182. m.Scale = Vector3.new(1,1,.5)
  183. weld(la,l_gem,CFrame.new(0,-.6,-.5))
  184. local l_a1 = clone(part)
  185. l_a1.Size = Vector3.new(.2,.5,.2)
  186. l_a1.BrickColor = BrickColor.new("Dark stone grey")
  187. l_a1.Reflectance = .2
  188. local m = Instance.new("BlockMesh",l_a1)
  189. m.Scale = Vector3.new(.25,.8,.25)
  190. weld(l_gem,l_a1,CFrame.new(.05,-.275,0))
  191. local l_a2 = clone(l_a1)
  192. weld(l_gem,l_a2,CFrame.new(-.05,-.275,0))
  193. local l_b1 = clone(l_a1)
  194. l_b1.Size = Vector3.new(.2,.6,1)
  195. local m = l_b1.Mesh
  196. m.Scale = Vector3.new(.75,.25,1)
  197. weld(l_gem,l_b1,CFrame.new(0,-.475,.475))
  198. local l_bl1 = clone(part)
  199. l_bl1.Transparency = .5
  200. l_bl1.Size = Vector3.new(.2,5.8,.5) -- 2.5
  201. local m = Instance.new("SpecialMesh",l_bl1)
  202. m.MeshId = "rbxassetid://70988954"
  203. m.TextureId = "rbxassetid://103972499"
  204. m.VertexColor = Vector3.new(1,1,1)*1
  205. m.Scale = Vector3.new(1,1,1)*.675
  206. weld(l_gem,l_bl1,CFrame.new(0,-.19,-1.5)*CFrame.Angles(math.rad(-90),0,0))
  207. local seltime = 0
  208. con(bin.Selected:connect(function()
  209. sel = true
  210. seltime = tick()
  211. rs.DesiredAngle,ls.DesiredAngle = 0,0
  212. rs.CurrentAngle,ls.CurrentAngle = rrs.CurrentAngle,rls.CurrentAngle
  213. rrs.Part0,rls.Part0 = nil,nil
  214. rrs.Part1,rls.Part1 = nil,nil
  215. rs.Parent,ls.Parent = tor,tor
  216. rs.Part0,ls.Part0 = tor,tor
  217. rs.Part1,ls.Part1 = ra,la
  218. hum.WalkSpeed = basewalk
  219. end))
  220. con(bin.Deselected:connect(function()
  221. sel = false
  222. seltime = tick()
  223. rs.Part0,ls.Part0 = nil,nil
  224. rs.Part1,ls.Part1 = nil,nil
  225. rrs.CurrentAngle,rls.CurrentAngle = rs.CurrentAngle,ls.CurrentAngle
  226. rrs.Parent,rls.Parent = tor,tor
  227. rrs.Part0,rls.Part0 = tor,tor
  228. rrs.Part1,rls.Part1 = ra,la
  229. nk.C0 = nk0
  230. block = false
  231. hum.WalkSpeed = 16
  232. end))
  233. con(mouse.Button1Down:connect(function()
  234. b1down = tick()
  235. end))
  236. local kd = {}
  237. con(mouse.KeyDown:connect(function(k)
  238. kd[k] = tick()
  239. end))
  240. con(mouse.KeyUp:connect(function(k)
  241. kd[k] = nil
  242. end))
  243. function charNotificator(tar,text,col)
  244. if not tar then print("No tar") return end
  245. local c = tar.CFrame
  246. local m = Instance.new("Model",workspace)
  247. m.Name = text
  248. local h = Instance.new("Humanoid",m)
  249. h.MaxHealth = 0
  250. h.Name = "H"
  251. local p = part:Clone()
  252. p.Name = "Head"
  253. p.Parent = m
  254. p.Anchored = true
  255. p:BreakJoints()
  256. p.BrickColor = col
  257. p.CanCollide = false
  258. Instance.new("BlockMesh",p)
  259. p.Size = Vector3.new(.6,.2,.6)
  260. p.CFrame = CFrame.new(c.p) * CFrame.new((math.random()-.5)*2,2,(math.random()-.5)*2) * CFrame.Angles(0,math.pi,0)
  261. game:GetService("Debris"):AddItem(p,5)
  262. Spawn(function()
  263. for i=1,math.random(60,160) do
  264. p.CFrame = p.CFrame * CFrame.new(0,math.random()*0.08,0)
  265. wait(1/60)
  266. end
  267. m:Destroy()
  268. end)
  269. end
  270. b1down = 0
  271. local ran = math.random()
  272. local cam = workspace.CurrentCamera
  273. local t,r,l = CFrame.new(),CFrame.new(),CFrame.new()
  274. local blo = CFrame.new(0,2.84,0.16)
  275. local lb,rb = l_bl1.CFrame*blo,r_bl1.CFrame*blo
  276. con(run.Stepped:connect(oc(function()
  277. if not model:IsDescendantOf(workspace) then
  278. runend = true
  279. for i,v in pairs(cons) do
  280. pcall(function() v:disconnect() end)
  281. end
  282. rs:Destroy()
  283. ls:Destroy()
  284. nk.C0 = nk0
  285. fpa:Destroy()
  286. bin:Destroy()
  287. cmodel:Destroy()
  288. model:Destroy()
  289. end
  290. r_bl1.Transparency = sel and math.max(.5-(tick()-seltime),0)+(.1 + tickwave(1,.19,ran)) or math.min(math.max(r_bl1.Transparency/2,(tick()-seltime)),.5)*2
  291. r_gem.Reflectance = .5+tickwave(1.5,.5)
  292. r_gem.BrickColor = sel and BrickColor.Green() or BrickColor.Red()
  293. l_bl1.Transparency = sel and math.max(.5-(tick()-seltime),0)+(.1 + tickwave(1,.19,1-ran)) or math.min(math.max(l_bl1.Transparency/2,(tick()-seltime)),.5)*2
  294. l_gem.Reflectance = .5+tickwave(1.5,.5)
  295. l_gem.BrickColor = sel and BrickColor.Green() or BrickColor.Red()
  296. local cf = workspace.CurrentCamera.CoordinateFrame
  297. local fp = (cf.p-hd.Position).magnitude < 2
  298. fra.Transparency = fp and 0 or 1
  299. fla.Transparency = fra.Transparency
  300. local trail = sel and (ad1)
  301. local nr,nl = r_bl1.CFrame*blo,l_bl1.CFrame*blo
  302. if trail then
  303. --if (nr.p-rb.p).magnitude > .05 then
  304. local p = part:Clone()
  305. p.Parent = workspace
  306. p.BrickColor = BrickColor.new("Institutional white")
  307. p.Transparency = .6
  308. p.Anchored = true
  309. p:BreakJoints()
  310. p.Size = Vector3.new(.2,.2,(nr.p-rb.p).magnitude)
  311. p.CFrame = CFrame.new(nr.p:Lerp(rb.p,.5),nr.p) * CFrame.new(0,100,0)
  312. local m = Instance.new("BlockMesh",p)
  313. m.Scale = Vector3.new(.15,.15,1)
  314. m.Offset = Vector3.new(0,-100,0)
  315. Delay(.5,function()
  316. for i=.6,1,.05 do
  317. p.Transparency = i
  318. wait(1/60)
  319. end
  320. p:Destroy()
  321. end)
  322. --end
  323. --if (nl.p-lb.p).magnitude > .05 then
  324. local p = part:Clone()
  325. p.Parent = workspace
  326. p.BrickColor = BrickColor.new("Institutional white")
  327. p.Transparency = .6
  328. p.Anchored = true
  329. p:BreakJoints()
  330. p.Size = Vector3.new(.2,.2,(nl.p-lb.p).magnitude)
  331. p.CFrame = CFrame.new(nl.p:Lerp(lb.p,.5),nl.p) * CFrame.new(0,100,0)
  332. local m = Instance.new("BlockMesh",p)
  333. m.Scale = Vector3.new(.15,.15,1)
  334. m.Offset = Vector3.new(0,-100,0)
  335. Delay(.5,function()
  336. for i=.6,1,.05 do
  337. p.Transparency = i
  338. wait(1/60)
  339. end
  340. p:Destroy()
  341. end)
  342. --end
  343. end
  344. lb,rb = nl,nr
  345. if sel then
  346. nk.C0 = clerp(nk.C0,nk0 * CFrame.Angles(0,0,(sel and not block) and .1 or 0),.2)
  347. local wc = CFrame.new(tor.Position,tor.Position+cam.CoordinateFrame.lookVector*Vector3.new(1,0,1))
  348. tor.CFrame = clerp(wc,wc * CFrame.Angles(0,math.rad(not block and -15 or 0),0) * t,.6)
  349. if (block and not kd["0"]) or (char:FindFirstChild("Block") and (char.Block.Value <= 0 or not block)) then
  350. block = false
  351. br = tick() -(char:FindFirstChild("Block") and char.Block.Value >= 0 and .6*char.Block.Value or 0)
  352. pcall(function() char.Block:Destroy() end)
  353. r = CFrame.new()
  354. l = CFrame.new()
  355. hum.WalkSpeed = basewalk
  356. end
  357. if ((kd["0"] and not ad1)) and tick()-(br or 0) > 1.5 then
  358. if not block then block = tick() end
  359. hum.WalkSpeed = math.max(6,basewalk-10)
  360. r = CFrame.Angles(math.rad(-23),math.rad(0),math.rad(30))*CFrame.Angles(math.rad(10),math.rad(10),0)
  361. l = CFrame.Angles(math.rad(-20),math.rad(0),math.rad(-30))*CFrame.Angles(math.rad(10),math.rad(-10),0)
  362. if not char:FindFirstChild("Block") then
  363. local b = Instance.new("NumberValue",char)
  364. b.Name = "Block"
  365. b.Value = 4
  366. end
  367. end
  368. end
  369. if sel and tick()-b1down < 0.05 and not ad1 and not block then
  370. ad1 = true
  371. Spawn(function()
  372. hum.WalkSpeed = basewalk+5
  373. local rd,ld = {},{}
  374. local hf = function(d,hit)
  375. if tick()-(d[hit.Parent] or 0) < 0.05 then return end
  376. local s = hit.Parent:FindFirstChild("Block")
  377. local h = hit.Parent:FindFirstChild("Humanoid")
  378. if not h then return end
  379. d[hit.Parent] = tick()
  380. if s and s:IsA("NumberValue") and s.Value > 0 then
  381. s.Value = s.Value - 1
  382. charNotificator(hit.Parent:FindFirstChild("Head"),"BLOCK!",BrickColor.Blue())
  383. else
  384. local crit = math.random(1,25) == 4
  385. local dmg = math.ceil((math.random(2,8))*(crit and 2 or 1))
  386. h.Health = h.Health - dmg
  387. charNotificator(hit.Parent:FindFirstChild("Head"),(crit and "!"..dmg.."!" or dmg),crit and BrickColor.Yellow() or BrickColor.Red())
  388. end
  389. end
  390. local c1,c2 = con(r_bl1.Touched:connect(function(h) hf(rd,h) end)),con(l_bl1.Touched:connect(function(h) hf(ld,h) end))
  391. local w8 = .03
  392. Spawn(function()
  393. playSound("http://roblox.com/asset/?id=10209850",r_bl1,1,1)
  394. wait(1/25)
  395. playSound("http://roblox.com/asset/?id=10209850",l_bl1,1,1)
  396. wait(1/25)
  397. playSound("http://roblox.com/asset/?id=10209850",r_bl1,1,1)
  398. end)
  399. wait(w8)
  400. t = CFrame.Angles(0,math.rad(30),0)
  401. r = CFrame.Angles(math.rad(90),math.rad(0),math.rad(50))
  402. wait(w8)
  403. r = CFrame.Angles(math.rad(90),math.rad(0),math.rad(70))
  404. t = CFrame.Angles(0,math.rad(70),0)
  405. l = CFrame.Angles(0,0,math.rad(-40))
  406. wait(w8)
  407. r = CFrame.Angles(math.rad(-10),math.rad(10),math.rad(110))
  408. t = CFrame.Angles(0,math.rad(130),0)
  409. l = CFrame.Angles(0,0,math.rad(-120))
  410. wait(w8)
  411. r = CFrame.Angles(math.rad(-20),math.rad(10),math.rad(10))
  412. t = CFrame.Angles(0,math.rad(240),0)
  413. l = CFrame.Angles(0,0,math.rad(-80))
  414. wait(w8)
  415. l = CFrame.Angles(math.rad(-20),0,math.rad(10))
  416. t = CFrame.Angles(0,math.rad(290),0)
  417. wait(w8)
  418. l = CFrame.Angles(math.rad(-20),0,math.rad(80))
  419. t = CFrame.Angles(0,math.rad(320),0)
  420. wait(w8)
  421. t = CFrame.Angles(0,math.rad(360),0)
  422. wait(.1)
  423. c1:disconnect()
  424. c2:disconnect()
  425. t = CFrame.new()
  426. r = CFrame.new()
  427. l = CFrame.new()
  428. ad1 = false
  429. hum.WalkSpeed = basewalk
  430. end)
  431. end
  432. local wav1 = tickwave(3,4)
  433. local lvy = cam.CoordinateFrame.lookVector.Y
  434. rs.C0 = clerp(rs.C0,rc0 * CFrame.Angles(0,0,math.rad(45)*lvy) * (not sel and CFrame.new() or block and r or CFrame.new() * CFrame.Angles(math.rad(-20 + wav1),math.rad(10 + wav1),math.rad(-15 + wav1))) * r,.45)
  435. ls.C0 = clerp(ls.C0,lc0 * CFrame.Angles(0,0,math.rad(-45)*lvy) * (not sel and CFrame.new() or block and l or CFrame.new() * CFrame.Angles(math.rad(-20 + wav1),math.rad(10 + wav1),math.rad(-25 + wav1))) * l,.45)
  436. end)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement