rewr

Untitled

Sep 14th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.26 KB | None | 0 0
  1. --mediafire gtfo password
  2. --==Player Variables==--
  3. local player=game.Players.LocalPlayer
  4. local character=player.Character
  5. local head=character.Head
  6. local torso=character.Torso
  7. local humanoid=character.Humanoid
  8. local arm={
  9. Left=character["Left Arm"];
  10. Right=character["Right Arm"];
  11. }
  12. local leg={
  13. Left=character["Left Leg"];
  14. Right=character["Right Leg"];
  15. }
  16. --==Customizations==--
  17. local trailColor="White"
  18. local trailSize=.2
  19. local name="Sword of Heroes"
  20. local model
  21. local bin
  22. local safeList={"rigletto"}
  23. if character:findFirstChild(name) or player.Backpack:findFirstChild(name)~=nil then
  24. character:findFirstChild(name):remove()
  25. player.Backpack:findFirstChild(name):remove()
  26. bin=Instance.new("HopperBin", player.Backpack)
  27. bin.Name=name
  28. model=Instance.new("Model", character)
  29. model.Name=name
  30. else
  31. bin=Instance.new("HopperBin", player.Backpack)
  32. bin.Name=name
  33. model=Instance.new("Model", character)
  34. model.Name=name
  35. end
  36. local add={
  37. Part=function(parent, anc, coll, color, t, size, cf)
  38. local p=Instance.new("Part", parent)
  39. p.TopSurface="Smooth"
  40. p.BottomSurface="Smooth"
  41. p.FormFactor="Custom"
  42. p.Anchored=anc
  43. p.CanCollide=coll
  44. p.BrickColor=BrickColor.new(color)
  45. p.Transparency=t
  46. p.Size=size
  47. p.CFrame=cf
  48. return p
  49. end;
  50. Weld=function(parent, p1, c1)
  51. local w=Instance.new("Weld", parent)
  52. w.Part0=w.Parent or Parent
  53. w.Part1= p1
  54. w.C1=c1
  55. return w
  56. end;
  57. Mesh=function(ins, parent, scale, type)
  58. local m
  59. if ins=="CylinderMesh" or ins=="BlockMesh" then
  60. m=Instance.new(ins, parent)
  61. m.Scale=scale
  62. elseif ins=="SpecialMesh" then
  63. m=Instance.new(ins, parent)
  64. m.Scale=scale
  65. m.MeshType=type
  66. end
  67. return m
  68. end;
  69. Body=function(ins, parent, vector)
  70. local b
  71. if b=="BodyGyro" then
  72. b=Instance.new(ins, parent)
  73. b.maxTorque=Vector3.new(math.huge, math.huge, math.huge)
  74. b.cframe=vector
  75. elseif b=="BodyForce" then
  76. b=Instance.new(ins, parent)
  77. b.force=vector
  78. elseif b=="BodyVelocity" then
  79. b=Instance.new(ins, parent)
  80. b.maxForce=Vector3.new(math.huge, math.huge, math.huge)
  81. b.velocity=vector
  82. elseif b=="BodyPosition" then
  83. b=Instance.new(ins, parent)
  84. b.maxForce=Vector3.new(math.huge, math.huge, math.huge)
  85. v.position=vector
  86. end
  87. return b
  88. end;
  89. Sound=function(parent, id)
  90. local s=Instance.new("Sound", parent)
  91. s.SoundId=id
  92. return s
  93. end;
  94. }
  95. --==Deb Values==--
  96. local trailDeb=false
  97. local keyDeb=false
  98. local w, a, s, d=false, false, false, false
  99. local mouseDeb=false
  100. local combo=0
  101. local hitDeb=false
  102. local c=function(f)coroutine.resume(coroutine.create(f))end
  103. --==Other Variables==--
  104. local trailBricks={}
  105. local sword={}
  106. sword.Suit={}
  107. sword.Part={}
  108. sword.Mesh={}
  109. sword.Weld={}
  110. local fake={}
  111. fake.Arm={}
  112. fake.Arm.Left=nil
  113. fake.Arm.Right=nil
  114. fake.Leg={}
  115. fake.Leg.Left=nil
  116. fake.Leg.Right=nil
  117. fake.Head=nil
  118. fake.Torso=nil
  119. fake.Weld={}
  120. --==Functions==--
  121. function computePos(pos1, pos2)
  122. local pos3=Vector3.new(pos2.x, pos1.y, pos2.z)
  123. return CFrame.new(pos1, pos3)
  124. end
  125. function computeWeld(pos1, pos2)
  126. local pos3=(pos1/2+pos2/2)
  127. return pos3
  128. end
  129. function trail(obj)
  130. trailDeb=true
  131. local last=obj.Position
  132. c(function()
  133. while trailDeb==true do
  134. wait()
  135. local new=obj.Position
  136. local magnitude=(last-new).magnitude
  137. local distance=(last+new)/2
  138. local trailLine=add.Part(workspace, true, false, trailColor, 0, Vector3.new(trailSize, magnitude, trailSize), CFrame.new(distance, new)*CFrame.Angles(math.pi/2, 0, 0))
  139. local cylinderMesh=add.Mesh("SpecialMesh", trailLine, Vector3.new(1, 1, 1), "Head")
  140. trailLine.Name="Trail"
  141. last=new
  142. c(function()
  143. for i=1, 0, -.1 do
  144. wait()
  145. trailLine.Mesh.Scale=trailLine.Mesh.Scale*Vector3.new(i, 1, i)
  146. end
  147. trailLine:remove()
  148. end)
  149. end
  150. end)
  151. end
  152. --==MenuScript==--
  153. function createSword()
  154. sword.Suit={
  155. Carry=add.Part(model, false, false, "Really black", 0, Vector3.new(1, 1, 1), CFrame.new());
  156. CarryTip=add.Part(model, false, false, "Really black", 0, Vector3.new(1, 1, 1), CFrame.new());
  157. Sheat=add.Part(model, false, false, "Bright blue", 0, Vector3.new(1, 1, 1), CFrame.new());
  158. BeltFront=add.Part(model, false, false, "Bright blue", 0, Vector3.new(1, 1, 1), CFrame.new());
  159. BeltTop=add.Part(model, false, false, "Bright blue", 0, Vector3.new(1, 1, 1), CFrame.new());
  160. BeltBottom=add.Part(model, false, false, "Bright blue", 0, Vector3.new(1, 1, 1), CFrame.new());
  161. }
  162. sword.Part={
  163. Handle=add.Part(model, false, false, "Really black", 0, Vector3.new(1, 1, 1), CFrame.new());
  164. Hold=add.Part(model, false, false, "Really black", 0, Vector3.new(1, 1, 1), CFrame.new());
  165. Support=add.Part(model, false, false, "Bright red", 0, Vector3.new(1, 1, 1), CFrame.new());
  166. Blade=add.Part(model, false, false, "Dark stone grey", 0, Vector3.new(1, 1, 1), CFrame.new());
  167. BladeTip=add.Part(model, false, false, "Dark stone grey", 0, Vector3.new(1, 1, 1), CFrame.new());
  168. }
  169. sword.Mesh={
  170. Carry=add.Mesh("BlockMesh", sword.Suit.Carry, Vector3.new(.5, 6, .2), nil);
  171. CarryTip=add.Mesh("SpecialMesh", sword.Suit.CarryTip, Vector3.new(.2, 1, .5), "Wedge");
  172. Sheat=add.Mesh("BlockMesh", sword.Suit.Sheat, Vector3.new(.2, 4.5, .22), nil);
  173. BeltFront=add.Mesh("BlockMesh", sword.Suit.BeltFront, Vector3.new(.2, 3, .1), nil);
  174. BeltTop=add.Mesh("BlockMesh", sword.Suit.BeltTop, Vector3.new(.2, .1, 1.2), nil);
  175. BeltBottom=add.Mesh("BlockMesh", sword.Suit.BeltBottom, Vector3.new(.1, .2, 1.2), nil);
  176. --==SwordParts MESHES==--
  177. Handle=add.Mesh("CylinderMesh", sword.Part.Handle, Vector3.new(.2, .8, .2), nil);
  178. Hold=add.Mesh("CylinderMesh", sword.Part.Hold, Vector3.new(.5, .2, .5), nil);
  179. Support=add.Mesh("BlockMesh", sword.Part.Support, Vector3.new(.2, 2, .18), nil);
  180. Blade=add.Mesh("BlockMesh", sword.Part.Blade, Vector3.new(.45, 5, .15), nil);
  181. BladeTip=add.Mesh("SpecialMesh", sword.Part.BladeTip, Vector3.new(.15, 1, .45), "Wedge");
  182. }
  183. sword.Weld={
  184. Carry=add.Weld(sword.Suit.Carry, fake.Torso, CFrame.new(0, 0, computeWeld(sword.Mesh.Carry.Scale.z, fake.Torso.Size.z))*CFrame.Angles(0, 0, -math.rad(45)));
  185. CarryTip=add.Weld(sword.Suit.CarryTip, sword.Suit.Carry, CFrame.new(0, -computeWeld(sword.Mesh.CarryTip.Scale.y, sword.Mesh.Carry.Scale.y), 0)*CFrame.Angles(math.rad(180), -math.rad(90), 0));
  186. Sheat=add.Weld(sword.Suit.Sheat, sword.Suit.Carry, CFrame.new());
  187. BeltFront=add.Weld(sword.Suit.BeltFront, fake.Torso, CFrame.new(0, 0, -computeWeld(sword.Mesh.BeltFront.Scale.z, fake.Torso.Size.z))*CFrame.Angles(0, 0, -math.rad(45)));
  188. BeltTop=add.Weld(sword.Suit.BeltTop, fake.Torso, CFrame.new(1, computeWeld(sword.Mesh.BeltTop.Scale.y, fake.Torso.Size.y), 0));
  189. BeltBottom=add.Weld(sword.Suit.BeltBottom, fake.Torso, CFrame.new(-1, -1, 0));
  190. --==SwordParts WELDZ==--
  191. Handle=add.Weld(sword.Part.Handle, sword.Suit.Carry, CFrame.new(0, computeWeld(sword.Mesh.Handle.Scale.y, sword.Mesh.Carry.Scale.y)+.1, 0));
  192. Hold=add.Weld(sword.Part.Hold, sword.Part.Handle, CFrame.new(0, -computeWeld(sword.Mesh.Hold.Scale.y, sword.Mesh.Handle.Scale.y), 0));
  193. Support=add.Weld(sword.Part.Support, sword.Part.Hold, CFrame.new(0, -computeWeld(sword.Mesh.Support.Scale.y, sword.Mesh.Hold.Scale.y), 0));
  194. Blade=add.Weld(sword.Part.Blade, sword.Part.Hold, CFrame.new(0, -computeWeld(sword.Mesh.Blade.Scale.y, sword.Mesh.Hold.Scale.y), 0));
  195. BladeTip=add.Weld(sword.Part.BladeTip, sword.Part.Blade, CFrame.new(0, -computeWeld(sword.Mesh.BladeTip.Scale.y, sword.Mesh.Blade.Scale.y), 0)*CFrame.Angles(math.rad(180), -math.rad(90), 0));
  196. }
  197. end
  198. function createFake()
  199. torso.Transparency=1
  200. fake.Torso=add.Part(character, false, false, torso.Color, 0, Vector3.new(2, 2, 1), CFrame.new())
  201. fake.Torso.Name="__TorsoPrototype"
  202. fake.Arm.Left=add.Part(model, false, false, "Really black", 1, Vector3.new(1, 1, 1), CFrame.new())
  203. fake.Arm.Right=add.Part(model, false, false, "Really black", 1, Vector3.new(1, 1, 1), CFrame.new())
  204. fake.Leg.Left=add.Part(model, false, false, "Really black", 1, Vector3.new(1, 1, 1), CFrame.new())
  205. fake.Leg.Right=add.Part(model, false, false, "Really black", 1, Vector3.new(1, 1, 1), CFrame.new())
  206. fake.Weld={
  207. add.Weld(fake.Arm.Left, fake.Torso, CFrame.new(-1.5, .5, 0)); add.Weld(fake.Arm.Right, fake.Torso, CFrame.new(1.5, .5, 0)); add.Weld(fake.Torso, torso, CFrame.new(0, 0, 0));
  208. add.Weld(fake.Leg.Left, fake.Torso, CFrame.new(-.5, -1.5, 0)); add.Weld(fake.Leg.Right, fake.Torso, CFrame.new(.5, -1.5, 0));
  209. Left=add.Weld(fake.Arm.Left, arm.Left, CFrame.new(0, .5, 0));
  210. Right=add.Weld(fake.Arm.Right, arm.Right, CFrame.new(0, .5, 0));
  211. LegLeft=add.Weld(fake.Leg.Left, leg.Left, CFrame.new(0, .5, 0));
  212. LegRight=add.Weld(fake.Leg.Right, leg.Right, CFrame.new(0, .5, 0));
  213. Torso=add.Weld(fake.Torso, torso, CFrame.new());
  214. }
  215. end
  216. function slice(hit)
  217. if hit.ClassName=="Part" and hit.Parent~=character and hit.Name~="Base" and hit.Name~="Trail" then
  218. c(function()
  219. local yPos=hit.CFrame.p.y-(hit.Size.y/2)
  220. local pyPos=sword.Part.BladeTip.CFrame.p.y
  221. if pyPos<yPos or pyPos>(yPos+hit.Size.y) then return end
  222. local cut=hit:clone()
  223. local cut2=hit:clone()
  224. hit:remove()
  225. cut.Parent=workspace
  226. cut2.Parent=workspace
  227. cut.TopSurface="Smooth"; cut.BottomSurface="Smooth"
  228. cut2.TopSurface="Smooth"; cut2.BottomSurface="Smooth"
  229. cut.Anchored=true
  230. cut2.Anchored=true
  231. cut.CanCollide=true
  232. cut2.CanCollide=true
  233. cut.FormFactor="Custom"
  234. cut2.FormFactor="Custom"
  235. cut.Size=Vector3.new(cut.Size.x, cut.Size.y-(pyPos-yPos), cut.Size.z)
  236. cut2.Size=Vector3.new(cut2.Size.x, (pyPos-yPos), cut2.Size.z)
  237. cut.CFrame=hit.CFrame*CFrame.new(0, cut2.Size.y/2, 0)
  238. cut2.CFrame=hit.CFrame*CFrame.new(0, -cut.Size.y/2, 0)
  239. pcall(function() cut.Mesh.Scale=Vector3.new(cut.Mesh.Scale.x, cut.Mesh.Scale.y-(pyPos-hit.CFrame.p.y-hit.Mesh.Scale.y/2), cut.Mesh.Scale.z) end)
  240. pcall(function() cut2.Mesh.Scale=Vector3.new(cut2.Mesh.Scale.x, (pyPos-hit.CFrame.p.y-hit.Mesh.Scale.y/2), cut2.Mesh.Scale.z) end)
  241. for i=0, .1, .01 do
  242. wait()
  243. cut.CFrame=cut.CFrame*CFrame.new(1*i, 0, 0)
  244. cut2.CFrame=cut2.CFrame*CFrame.new(-1*i, 0, 0)
  245. end
  246. cut:remove()
  247. cut2:remove()
  248. end)
  249. end
  250. end
  251. function shadow(obj)
  252. local clone=obj:clone()
  253. clone.Anchored=true
  254. clone.CanCollide=false
  255. clone.CFrame=obj.CFrame
  256. clone.Transparency=0
  257. clone.Parent=workspace
  258. pcall(function() clone:findFirstChild("roblox"):remove() end)
  259. c(function()
  260. for i=0, 1, .1 do
  261. wait()
  262. clone.Transparency=i
  263. end
  264. clone:remove()
  265. end)
  266. end
  267. function forward()
  268. for i, v in pairs(character:getChildren()) do
  269. if v.ClassName=="Part" then
  270. shadow(v)
  271. end
  272. end
  273. for i, v in pairs(sword.Part) do
  274. shadow(v)
  275. end
  276. for i, v in pairs(sword.Suit) do
  277. shadow(v)
  278. end
  279. torso.CFrame=torso.CFrame+torso.CFrame.lookVector*20
  280. end
  281. function jump()
  282. humanoid.Jump=false
  283. for i, v in pairs(character:getChildren()) do
  284. if v.ClassName=="Part" then
  285. shadow(v)
  286. end
  287. end
  288. for i, v in pairs(sword.Part) do
  289. shadow(v)
  290. end
  291. for i, v in pairs(sword.Suit) do
  292. shadow(v)
  293. end
  294. torso.CFrame=torso.CFrame*CFrame.new(0, 20, 0)
  295. end
  296. function keyDown(key)
  297. if key=="f" then forward() end
  298. if key==" " then jump() end
  299. end
  300. function keyUp(key)
  301. end
  302. local slashSound=add.Sound(torso, "rbxasset://sounds//swordslash.wav")
  303. function attackMouse()
  304. combo=combo+1
  305. if combo==1 and mouseDeb==false then
  306. slashSound:Play()
  307. trail(sword.Part.BladeTip)
  308. mouseDeb=true
  309. animate=true
  310. fake.Weld.Right.C0=CFrame.Angles(0, 0, math.rad(90))
  311. for i=0, 1, .2 do
  312. wait()
  313. sword.Weld.Handle.C0=CFrame.Angles(0, 0, -math.rad(45)*i)
  314. fake.Weld.Torso.C0=CFrame.Angles(0, -math.rad(90)*i, 0)
  315. fake.Weld.Right.C0=CFrame.Angles(0, math.rad(45)*i, math.rad(90))
  316. end
  317. if combo<1 then combo=2
  318. animate=true
  319. mouseDeb=true
  320. trail(sword.Part.BladeTip)
  321. for i=0, 1, .2 do
  322. wait()
  323. fake.Weld.Right.C0=CFrame.Angles(0, math.rad(45)-(math.rad(180)*i), math.rad(90))
  324. end
  325. trailDeb=false
  326. for i=1, 0, -.2 do
  327. wait()
  328. sword.Weld.Handle.C0=CFrame.Angles(0, 0, -math.rad(45)*i)
  329. fake.Weld.Torso.C0=CFrame.Angles(0, -math.rad(90)*i, 0)
  330. fake.Weld.Right.C0=CFrame.Angles(0, -math.rad(135)*i, math.rad(90)*i)
  331. end
  332. mouseDeb=false
  333. animate=false
  334. return
  335. end
  336. trailDeb=false
  337. for i=1, 0, -.2 do
  338. wait()
  339. sword.Weld.Handle.C0=CFrame.Angles(0, 0, -math.rad(45)*i)
  340. fake.Weld.Torso.C0=CFrame.Angles(0, -math.rad(90)*i, 0)
  341. fake.Weld.Right.C0=CFrame.Angles(math.rad(45)*i, math.rad(45)*i, 0)
  342. end
  343. mouseDeb=false
  344. animate=false
  345. end
  346. combo=0
  347. end
  348. local selectDeb=false
  349. local deb=false
  350. function onSelected(mouse)
  351. bin:remove()
  352. print("Selected")
  353. createFake()
  354. if deb==false then
  355. deb=true
  356. createSword()
  357. end
  358. humanoid.WalkSpeed=50
  359. humanoid.MaxHealth=math.huge
  360. if selectDeb==false then
  361. selectDeb=true
  362. for i=0, 1, .1 do
  363. wait()
  364. sword.Part.Handle.Transparency=i
  365. sword.Part.Hold.Transparency=i
  366. sword.Part.Support.Transparency=i
  367. sword.Part.Blade.Transparency=i
  368. sword.Part.BladeTip.Transparency=i
  369. sword.Weld.Handle.C1=CFrame.new(0, computeWeld(sword.Mesh.Handle.Scale.y, sword.Mesh.Carry.Scale.y)+.1+2*i, 0)
  370. fake.Weld.Right.C0=CFrame.Angles(math.rad(90)*i, 0, math.rad(90)*i)
  371. end
  372. sword.Weld.Handle.Part1=arm.Right
  373. sword.Weld.Handle.C1=CFrame.new(0, -1, 0)*CFrame.Angles(math.rad(90), -math.rad(90), 0)
  374. for i=1, 0, -.1 do
  375. wait()
  376. sword.Part.Handle.Transparency=i
  377. sword.Part.Hold.Transparency=i
  378. sword.Part.Support.Transparency=i
  379. sword.Part.Blade.Transparency=i
  380. sword.Part.BladeTip.Transparency=i
  381. fake.Weld.Right.C0=CFrame.Angles(math.rad(90)*i, 0, math.rad(90)*i)
  382. end
  383. selectDeb=false
  384. end
  385. mouse.KeyDown:connect(keyDown)
  386. mouse.KeyUp:connect(keyUp)
  387. mouse.Button1Down:connect(attackMouse)
  388. for i, v in pairs(sword.Part) do
  389. local event=v.Touched:connect(slice)
  390. while event do wait() end
  391. event:disconnect()
  392. end
  393. end
  394. script.Parent=bin
  395. bin.Selected:connect(onSelected)
Add Comment
Please, Sign In to add comment