Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --vars
- plr = game.Players.LocalPlayer;
- chr = plr.Character or plr.Character:wait();
- mouse = plr:getMouse();
- renderstepped = game:GetService('RunService').RenderStepped;
- userinput = game:GetService('UserInputService');
- tweenservice = game:GetService("TweenService");
- head = chr:WaitForChild("Head");
- torso = chr.Torso;
- myhum = chr.Humanoid;
- arm = chr["Right Arm"];
- attacking,defending,typing = false,false,false;
- spinning = true;
- --initializing
- blade = Instance.new("Part",chr);
- blade.CanCollide = false;
- blade.Name = "blade"
- blade.Material = Enum.Material.Neon
- blade.BrickColor = BrickColor.new("Really black");
- blade.Size = Vector3.new(6,.2,.2);
- bladeAttatchment = Instance.new("Attachment",blade);
- bladeAttatchment.Position = Vector3.new(3,0,0);
- bladeAttatchment2 = Instance.new("Attachment",blade);
- bladeAttatchment2.Position = Vector3.new(-3,0,0);
- bladeTrail = Instance.new("Trail",blade);
- bladeTrail.Color = ColorSequence.new(Color3.new(0.666667, 0, 1));
- bladeTrail.LightEmission = 1;
- bladeTrail.Lifetime = .4;
- bladeTrail.Attachment0 = bladeAttatchment;
- bladeTrail.Attachment1 = bladeAttatchment2;
- handle = Instance.new("Part",chr);
- handle.CanCollide = false;
- handle.Material = Enum.Material.Glass;
- handle.Name = "handle";
- handle.Size = Vector3.new(0.4, 0.4, 0.4);
- handleMesh = Instance.new("SpecialMesh",handle);
- handleMesh.MeshType = Enum.MeshType.Cylinder;
- joint = Instance.new("Part",chr);
- joint.Transparency = 1;
- joint.Name = "joint";
- joint.Size = Vector3.new(.2,.2,.2)
- jointWeld,torsoWeld = Instance.new("Weld",joint),Instance.new("Weld",joint);
- jointWeld.Name = "j";
- torsoWeld.Name = "t";
- jointWeld.Part0 = joint;
- jointWeld.Part1 = arm;
- jointWeld.C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-10));
- torsoWeld.Part0 = torso;
- torsoWeld.Part1 = joint;
- torsoWeld.C1 = CFrame.new(-1.1,-.9,0);
- handleWeld = Instance.new("Weld",handle);
- handleWeld.Part0 = handle;
- handleWeld.Part1 = blade;
- handleWeld.C0,handleWeld.C1 = CFrame.new(0,0,0),CFrame.new(0,0,0);
- armWeld = Instance.new("Weld",arm);
- armWeld.Part0 = arm;
- armWeld.Part1 = handle;
- armWeld.C1 = CFrame.new(0,1,0)*CFrame.Angles(0,math.rad(90),0);
- blood = Instance.new("Part");
- blood.Size = Vector3.new(.4,.1,.4);
- blood.BrickColor = BrickColor.new("Crimson");
- bloodMesh = Instance.new("SpecialMesh",blood);
- --anims
- tweenInfo = TweenInfo.new(.4,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
- tweenInfo2 = TweenInfo.new(.4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut);
- function spin()
- tweenInfo = TweenInfo.new(.4,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
- tweenInfo2 = TweenInfo.new(.4,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut);
- while wait(.4) and spinning do
- 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)))});
- local tweenSword = tweenservice:Create(armWeld,tweenInfo2,{C1 = armWeld.C1*CFrame.Angles(0,math.rad(170),0)});
- tweenArm:Play();
- tweenSword:Play();
- end
- end
- spawn(spin);
- function weldLerp(weld,speed,start,finish)
- for i = 0,1,speed do
- renderstepped:wait();
- weld.C1 = start:lerp(finish,i)
- end
- end
- --testing function
- debounce = false;
- blade.Touched:connect(function(hit)
- if hit and hit.Parent and hit.Parent~=chr and not debounce then
- debounce = true;
- local h = hit.Parent:FindFirstChild("Humanoid");
- if h then
- h.Health = h.Health - 25;
- for i = 1,5 do
- local clone = blood:Clone();
- clone.Parent = workspace;
- clone.CFrame = hit.CFrame*CFrame.new(math.random(),0,-math.random());
- local function cleanup()
- wait(3);
- clone:Destroy();
- end
- spawn(cleanup);
- end
- end
- wait();
- debounce = false;
- end
- end)
- tweenInfo = TweenInfo.new();
- tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-45))});
- tweenSword = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-45))});
- function tweenDetails(speed,style,direction)
- tweenInfo = TweenInfo.new(speed,style,direction);
- end
- function armTween(goals)
- tweenArm = tweenservice:Create(jointWeld,tweenInfo,goals);
- tweenArm:Play();
- end
- function swordTween(goals)
- tweenSword = tweenservice:Create(armWeld,tweenInfo,goals);
- tweenSword:Play();
- end
- userinput.InputBegan:connect(function(input)
- if input.UserInputType == Enum.UserInputType.Keyboard then
- local key = input.KeyCode;
- if key == Enum.KeyCode.Q and not typing and not attacking and not defending then
- attacking = true;
- spinning = false;
- local tweenInfo = TweenInfo.new(.6,Enum.EasingStyle.Quint,Enum.EasingDirection.InOut);
- local tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-45))});
- tweenArm:Play();
- wait(.6);
- local tweenInfo = TweenInfo.new(.15,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
- tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(-90),0,0)});
- tweenArm:Play();
- local function lerp()
- local endpos = CFrame.new(arm.CFrame.lookVector*50);
- local startpos = armWeld.C1;
- weldLerp(armWeld,.025,startpos,endpos);
- end
- wait(.15);
- lerp();
- tweenInfo = TweenInfo.new(.4,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut);
- tweenArm = tweenservice:Create(jointWeld,tweenInfo,{C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(10),0,math.rad(-60))});
- tweenArm:Play();
- function lerp()
- local startpos = armWeld.C1;
- weldLerp(armWeld,.01,startpos,CFrame.new(0,1,0)*CFrame.Angles(0,math.rad(90),0));
- armWeld.C1 = CFrame.new(0,1,0)*CFrame.Angles(0,math.rad(90),0);
- end
- lerp();
- wait();
- spinning = true;
- spawn(spin);
- attacking = false;
- elseif key == Enum.KeyCode.E and not attacking and not defending and not typing then
- attacking = true;
- spinning = false;
- tweenDetails(.6,Enum.EasingStyle.Quart,Enum.EasingDirection.InOut);
- armTween({C1 = CFrame.new(-0.4,0.9,0)*CFrame.Angles(math.rad(-90),math.rad(-30),math.rad(-30))});
- wait(.6);
- tweenDetails(.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut);
- for i = 1,10 do
- swordTween({C1 = armWeld.C1*CFrame.Angles(0,math.rad(170),0)});
- wait(.25)
- end
- swordTween({C1 = armWeld.C1*CFrame.Angles(0,math.rad(170),0)});
- wait(.5);
- spinning = true;
- spawn(spin);
- attacking = false;
- elseif key == Enum.KeyCode.KeypadEnter or key == Enum.KeyCode.Return or input.UserInputType == Enum.UserInputType.MouseButton1 then
- typing = false;
- elseif key == Enum.KeyCode.Slash then
- typing = true;
- end
- end
- end)
- --[[function tweenDetails(speed,style,direction)
- tweenInfo = TweenInfo.new(speed,style,direction);
- end
- function armTween(goals)
- tweenArm = tweenservice:Create(jointWeld,tweenInfo,goals);
- tweenArm:Play();
- end
- function swordTween(goals)
- tweenSword = tweenservice:Create(armWeld,tweenInfo,goals);
- tweenSword:Play();
- end]]
Add Comment
Please, Sign In to add comment