urabigfatnoob

Untitled

Feb 3rd, 2021 (edited)
1,118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.00 KB | None | 0 0
  1. --vars
  2. plr = game.Players.LocalPlayer;
  3. chr = plr.Character or plr.Character:wait();
  4. mouse = plr:getMouse();
  5. renderstepped = game:GetService('RunService').RenderStepped;
  6. userinput = game:GetService('UserInputService');
  7. tweenservice = game:GetService("TweenService");
  8. head = chr:WaitForChild("Head");
  9. torso = chr.Torso;
  10. myhum = chr.Humanoid;
  11. arm = chr["Right Arm"];
  12. attacking,defending,typing = false,false,false;
  13. spinning = true;
  14. --initializing
  15. blade = Instance.new("Part",chr);
  16. blade.CanCollide = false;
  17. blade.Name = "blade"
  18. blade.Material = Enum.Material.Neon
  19. blade.BrickColor = BrickColor.new("Really black");
  20. blade.Size = Vector3.new(6,.2,.2);
  21.  
  22. bladeAttatchment = Instance.new("Attachment",blade);
  23. bladeAttatchment.Position = Vector3.new(3,0,0);
  24. bladeAttatchment2 = Instance.new("Attachment",blade);
  25. bladeAttatchment2.Position = Vector3.new(-3,0,0);
  26. bladeTrail = Instance.new("Trail",blade);
  27. bladeTrail.Color = ColorSequence.new(Color3.new(0.666667, 0, 1));
  28. bladeTrail.LightEmission = 1;
  29. bladeTrail.Lifetime = .4;
  30. bladeTrail.Attachment0 = bladeAttatchment;
  31. bladeTrail.Attachment1 = bladeAttatchment2;
  32.  
  33. handle = Instance.new("Part",chr);
  34. handle.CanCollide = false;
  35. handle.Material = Enum.Material.Glass;
  36. handle.Name = "handle";
  37. handle.Size = Vector3.new(0.4, 0.4, 0.4);
  38. handleMesh = Instance.new("SpecialMesh",handle);
  39. handleMesh.MeshType = Enum.MeshType.Cylinder;
  40.  
  41. joint = Instance.new("Part",chr);
  42. joint.Transparency = 1;
  43. joint.Name = "joint";
  44. joint.Size = Vector3.new(.2,.2,.2)
  45.  
  46. jointWeld,torsoWeld = Instance.new("Weld",joint),Instance.new("Weld",joint);
  47. jointWeld.Name = "j";
  48. torsoWeld.Name = "t";
  49. jointWeld.Part0 = joint;
  50. jointWeld.Part1 = arm;
  51. jointWeld.C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-10));
  52. torsoWeld.Part0 = torso;
  53. torsoWeld.Part1 = joint;
  54. torsoWeld.C1 = CFrame.new(-1.1,-.9,0);
  55.  
  56. handleWeld = Instance.new("Weld",handle);
  57. handleWeld.Part0 = handle;
  58. handleWeld.Part1 = blade;
  59. handleWeld.C0,handleWeld.C1 = CFrame.new(0,0,0),CFrame.new(0,0,0);
  60.  
  61. armWeld = Instance.new("Weld",arm);
  62. armWeld.Part0 = arm;
  63. armWeld.Part1 = handle;
  64. armWeld.C1 = CFrame.new(0,1,0)*CFrame.Angles(0,math.rad(90),0);
  65.  
  66. blood = Instance.new("Part");
  67. blood.Size = Vector3.new(.4,.1,.4);
  68. blood.BrickColor = BrickColor.new("Crimson");
  69. bloodMesh = Instance.new("SpecialMesh",blood);
  70.  
  71. --anims
  72. tweenInfo = TweenInfo.new(.4,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
  73. tweenInfo2 = TweenInfo.new(.4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut);
  74. function spin()
  75.     tweenInfo = TweenInfo.new(.4,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
  76.     tweenInfo2 = TweenInfo.new(.4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut);
  77.     while wait(.4) and spinning do
  78.         local tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-.4,0.9,0)*CFrame.Angles(math.rad(math.random(-100,20)),0,math.rad(math.random(-120,-10)))});
  79.         local tweenSword = tweenservice:Create(armWeld,tweenInfo2,{C1 = armWeld.C1*CFrame.Angles(0,math.rad(170),0)});
  80.         tweenArm:Play();
  81.         tweenSword:Play();
  82.     end
  83. end
  84. spawn(spin);
  85.  
  86. function weldLerp(weld,speed,start,finish)
  87.     for i = 0,1,speed do
  88.         renderstepped:wait();
  89.         weld.C1 = start:lerp(finish,i)
  90.     end
  91. end
  92. --testing function
  93. debounce = false;
  94. blade.Touched:connect(function(hit)
  95.     if hit and hit.Parent and hit.Parent~=chr and not debounce then
  96.         debounce = true;
  97.         local h = hit.Parent:FindFirstChild("Humanoid");
  98.         if h then
  99.             h.Health = h.Health - 25;
  100.             for i = 1,5 do
  101.                 local clone = blood:Clone();
  102.                 clone.Parent = workspace;
  103.                 clone.CFrame = hit.CFrame*CFrame.new(math.random(),0,-math.random());
  104.                 local function cleanup()
  105.                     wait(3);
  106.                     clone:Destroy();
  107.                 end
  108.                 spawn(cleanup);
  109.             end
  110.         end
  111.         wait();
  112.         debounce = false;
  113.     end
  114. end)
  115.  
  116. tweenInfo = TweenInfo.new();
  117. tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-45))});
  118. tweenSword = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-45))});
  119.  
  120. function tweenDetails(speed,style,direction)
  121.     tweenInfo = TweenInfo.new(speed,style,direction);
  122. end
  123.  
  124. function armTween(goals)
  125.     tweenArm = tweenservice:Create(jointWeld,tweenInfo,goals);
  126.     tweenArm:Play();
  127. end
  128.  
  129. function swordTween(goals)
  130.     tweenSword = tweenservice:Create(armWeld,tweenInfo,goals);
  131.     tweenSword:Play();
  132. end
  133.  
  134. userinput.InputBegan:connect(function(input)
  135.     if input.UserInputType == Enum.UserInputType.Keyboard then
  136.         local key = input.KeyCode;
  137.         if key == Enum.KeyCode.Q and not typing and not attacking and not defending then
  138.             attacking = true;
  139.             spinning = false;
  140.             local tweenInfo = TweenInfo.new(.6,Enum.EasingStyle.Quint,Enum.EasingDirection.InOut);
  141.             local tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-45))});
  142.             tweenArm:Play();
  143.             wait(.6);
  144.             local tweenInfo = TweenInfo.new(.15,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
  145.             tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(-90),0,0)});
  146.             tweenArm:Play();
  147.             local function lerp()
  148.                 local endpos = CFrame.new(arm.CFrame.lookVector*50);
  149.                 local startpos = armWeld.C1;
  150.                 weldLerp(armWeld,.025,startpos,endpos);
  151.             end
  152.             wait(.15);
  153.             lerp();
  154.             tweenInfo = TweenInfo.new(.4,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
  155.             tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-60))});
  156.             tweenArm:Play();
  157.             function lerp()
  158.                 local startpos = armWeld.C1;
  159.                 weldLerp(armWeld,.01,startpos,CFrame.new(0,1,0)*CFrame.Angles(0,math.rad(90),0));
  160.                 armWeld.C1 = CFrame.new(0,1,0)*CFrame.Angles(0,math.rad(90),0);
  161.             end
  162.             lerp();
  163.             wait();
  164.             spinning = true;
  165.             spawn(spin);
  166.             attacking = false;
  167.         elseif key == Enum.KeyCode.E and not attacking and not defending and not typing then
  168.             attacking = true;
  169.             spinning = false;
  170.             tweenDetails(.6,Enum.EasingStyle.Quart,Enum.EasingDirection.InOut);
  171.             armTween({C1 =  CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(-90),math.rad(-30),math.rad(-30))});
  172.             wait(.6);
  173.             tweenDetails(.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut);
  174.             for i = 1,10 do
  175.                 swordTween({C1 = armWeld.C1*CFrame.Angles(0,math.rad(170),0)});
  176.                 wait(.25)
  177.             end
  178.             swordTween({C1 = armWeld.C1*CFrame.Angles(0,math.rad(170),0)});
  179.             wait(.5);
  180.             spinning = true;
  181.             spawn(spin);
  182.             attacking = false;
  183.         elseif key == Enum.KeyCode.KeypadEnter or key == Enum.KeyCode.Return or input.UserInputType == Enum.UserInputType.MouseButton1 then
  184.             typing = false;
  185.         elseif key == Enum.KeyCode.Slash then
  186.             typing = true;
  187.         end
  188.     end
  189. end)
  190.  
  191. --[[function tweenDetails(speed,style,direction)
  192.     tweenInfo = TweenInfo.new(speed,style,direction);
  193. end
  194.  
  195. function armTween(goals)
  196.     tweenArm = tweenservice:Create(jointWeld,tweenInfo,goals);
  197.     tweenArm:Play();
  198. end
  199.  
  200. function swordTween(goals)
  201.     tweenSword = tweenservice:Create(armWeld,tweenInfo,goals);
  202.     tweenSword:Play();
  203. end]]
Add Comment
Please, Sign In to add comment