Tool=script.Parent Handle=Tool:WaitForChild("\072\097\110\100\108\101")Players=game:GetService("\080\108\097\121\101\114\115")Debris=game:GetService("\068\101\098\114\105\115")RunService=game:GetService("\082\117\110\083\101\114\118\105\099\101")RbxUtility=LoadLibrary("\082\098\120\085\116\105\108\105\116\121")Create=RbxUtility.Create black=BrickColor.new("\082\101\097\108\108\121 \098\108\097\099\107")BaseUrl="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061"LastAttack=0 Lunging=false Grips={Up=CFrame.new(0,-1.7,0,1,0,0,0,1,0,0,0,1),Out=CFrame.new(0,-1.7,0,1,0,0,0,0,-1,0,1,0)}Sounds={Unsheath=Handle:WaitForChild("\085\110\115\104\101\097\116\104\083\111\117\110\100");Slash=Handle:WaitForChild("\083\108\097\115\104\083\111\117\110\100");Lunge=Handle:WaitForChild("\076\117\110\103\101\083\111\117\110\100")}BasePart=(Create("\080\097\114\116"))({Material=Enum.Material.Plastic,Shape=Enum.PartType.Block;TopSurface=Enum.SurfaceType.Smooth;BottomSurface=Enum.SurfaceType.Smooth;FormFactor=Enum.FormFactor.Custom,Size=Vector3.new(.2,.2,.2),CanCollide=true;Locked=true})SoulFire=(Create("\070\105\114\101"))({Name="\070\105\114\101",Color=Color3.new(1.0,.0,.0);SecondaryColor=Color3.new(.33333333333333,.0,.0);Heat=18;Size=2.5;Enabled=true})SoulLight=(Create("\080\111\105\110\116\076\105\103\104\116"))({Name="\076\105\103\104\116";Color=SoulFire.Color,Brightness=35,Range=4;Shadows=false;Enabled=true})Gravity=196.2 SwordDamage=25 ToolEquipped=false ServerControl=Tool:FindFirstChild("\083\101\114\118\101\114\067\111\110\116\114\111\108")or(Create("\082\101\109\111\116\101\070\117\110\099\116\105\111\110"))({Name="\083\101\114\118\101\114\067\111\110\116\114\111\108";Parent=Tool})ClientControl=Tool:FindFirstChild("\067\108\105\101\110\116\067\111\110\116\114\111\108")or(Create("\082\101\109\111\116\101\070\117\110\099\116\105\111\110"))({Name="\067\108\105\101\110\116\067\111\110\116\114\111\108",Parent=Tool})Tool.Grip=Grips.Up Tool.Enabled=true function IsTeamMate(M,Z)local U=M.TeamColor local v=Z.TeamColor return not(U~=v or U==black and v==black)end function TagHumanoid(M,Z)local U=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114",Value=Z})Debris:AddItem(U,2)U.Parent=M end function UntagHumanoid(M)for M,Z in pairs(M:GetChildren())do if Z:IsA("\079\098\106\101\099\116\086\097\108\117\101")and Z.Name=="\099\114\101\097\116\111\114"then Z:Destroy()end end end function Blow(M,Z)local U U=M.Touched:connect(function(M)if not M or not M.Parent or not CheckIfAlive()then return end local U=Character:FindFirstChild("\082\105\103\104\116 \065\114\109")if not U then return end local v=U:FindFirstChild("\082\105\103\104\116\071\114\105\112")if not v or v.Part0~=Handle and v.Part1~=Handle then return end local u=M.Parent if u==Character then return end local y=u:FindFirstChild("\072\117\109\097\110\111\105\100")if not y or y.Health==0 then return end local A=Players:GetPlayerFromCharacter(u)if A and(A==Player or IsTeamMate(Player,A))then return end local C=y.Health-Z UntagHumanoid(y)TagHumanoid(y,Player)y:TakeDamage(Z)spawn(function()y.WalkSpeed=9 wait(1.25)y.WalkSpeed=16 end)end)return U end function CreateTrail(M,Z)local U local v=(Create("\073\110\116\086\097\108\117\101"))({Value=0})local u=(Create("\066\111\111\108\086\097\108\117\101"))({Value=true})spawn(function()while u.Value and(ToolEquipped and CheckIfAlive())do local M=Handle:Clone()M.Name="\069\102\102\101\099\116"M.CanCollide=false M.Anchored=true Blow(M,5)v.Value=v.Value+1 Debris:AddItem(M,1)M.Parent=game:GetService("\087\111\114\107\115\112\097\099\101")M.CFrame=Handle.CFrame wait(Z)end end)return{Connection=U,Count=v;Enabled=u}end function Lunge()Lunging=true local M=InvokeClient("\077\111\117\115\101\080\111\115\105\116\105\111\110")if not M then return end local Z=M.Position local U=(CFrame.new(Torso.Position,Z)).lookVector*Vector3.new(1,0,1)Tool.Grip=Grips.Out Sounds.Lunge:Play()if U.Magnitude>.01 then U=U.Unit local M=(Create("\066\111\100\121\086\101\108\111\099\105\116\121"))({P=100000,maxForce=Vector3.new(100000,0,100000);velocity=U*50})Debris:AddItem(M,.75)M.Parent=Torso Torso.CFrame=CFrame.new(Torso.Position,Z*Vector3.new(1,0,1)+Vector3.new(0,Torso.Position.Y,0))end spawn(function()local M=CreateTrail(5,.08)while Lunging and(CheckIfAlive()and ToolEquipped)do RunService.Stepped:wait()end M.Enabled.Value=false end)wait(.75)Lunging=false Tool.Grip=Grips.Up wait(.5)end function Attack()Tool.Grip=Grips.Up Sounds.Slash:Play()local M=(Create("\083\116\114\105\110\103\086\097\108\117\101"))({Name="\116\111\111\108\097\110\105\109",Value="\083\108\097\115\104";Parent=Tool})spawn(function()local M=CreateTrail(5,.06)while M.Count.Value<4 and(CheckIfAlive()and ToolEquipped)do RunService.Stepped:wait()end M.Enabled.Value=false end)Tool.Grip=Grips.Up end function ConsumeTarget(M,Z)local U=BasePart:Clone()U.Name="\069\102\102\101\099\116"U.Transparency=1 U.Size=Vector3.new(.5,.5,.5)U.CanCollide=false local v=SoulFire:Clone()v.Size=1 v.Enabled=true v.Parent=U local u=SoulLight:Clone()u.Color=v.Color u.Enabled=true u.Parent=U if Z and Z<3 then Z=3 end if M then local v=M:FindFirstChild("\084\111\114\115\111")if v then Z=Z or 4 for M=1,Z,1 do local Z=U:Clone()Z.CFrame=Torso.CFrame+Torso.CFrame.lookVector*4 local u=(Create("\082\111\099\107\101\116\080\114\111\112\117\108\115\105\111\110"))({Target=v;TargetOffset=Vector3.new(0,2,0);ThrustP=500;ThrustD=5,MaxSpeed=150;MaxTorque=Vector3.new(4000000,4000000,0);Parent=Z})Debris:AddItem(Z,15)Z.Parent=game:GetService("\087\111\114\107\115\112\097\099\101")u.ReachedTarget:connect(function()if not CheckIfAlive()then return end if Z and Z.Parent then Z:Destroy()end end)u:Fire()wait(.25)end end else local M=InvokeClient("\077\111\117\115\101\080\111\115\105\116\105\111\110")if M then M=M.Position local Z=(M-Torso.Position).Unit for M=1,5,1 do local v=U:Clone()v.CFrame=Torso.CFrame+Torso.CFrame.lookVector*4 local u=Z*150 local y=v:GetMass()*Gravity local A=(Create("\066\111\100\121\070\111\114\099\101"))({Parent=v;force=Vector3.new(0,v:GetMass()*196.2,0)})v.Velocity=u v.Touched:connect(function(M)if not M or not M.Parent then return end local Z=M.Parent if Z:IsA("\072\097\116")then Z=M.Parent end local U=Z:FindFirstChild("\072\117\109\097\110\111\105\100")if not U or U.Health==0 then return end local u=Players:GetPlayerFromCharacter(Z)if u and(Player==u or IsTeamMate(Player,u))then return end if v and v.Parent then v:Destroy()end end)Debris:AddItem(v,15)v.Parent=game:GetService("\087\111\114\107\115\112\097\099\101")end end end end function CheckIfAlive()return(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and(Humanoid.Health>0 and(Torso and(Torso.Parent and(Player and Player.Parent))))))))and true or false end function Activated()if not Tool.Enabled or not ToolEquipped or not CheckIfAlive()then return end Tool.Enabled=false local M=RunService.Stepped:wait()if M-LastAttack<.2 then Lunge()else Attack()end LastAttack=M Tool.Enabled=true end function Equipped()Character=Tool.Parent Player=Players:GetPlayerFromCharacter(Character)Humanoid=Character:FindFirstChild("\072\117\109\097\110\111\105\100")Torso=Character:FindFirstChild("\084\111\114\115\111")if not CheckIfAlive()then return end ToolEquipped=true spawn(function()local M=true ToolUnequipped1=Tool.Unequipped:connect(function()M=false if ToolUnequipped1 then ToolUnequipped1:disconnect()end end)Sounds.Unsheath:Play()Humanoid.WalkSpeed=18 spawn(function()while ToolEquipped and(M and CheckIfAlive())do wait(1)if not ToolEquipped or not M or not CheckIfAlive()then break end Humanoid.Health=Humanoid.Health+.25 end end)end)end function Unequipped()if CheckIfAlive()then Humanoid.WalkSpeed=16 end Tool.Grip=Grips.Up ToolEquipped=false end function InvokeClient(M,Z)local U=nil pcall(function()U=ClientControl:InvokeClient(Player,M,Z)end)return U end Tool.Activated:connect(Activated)Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)Blow(Handle,SwordDamage)


Tool = script.Parent
Handle = Tool:WaitForChild("Handle")

Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")

RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create

black= BrickColor.new("Really black")

BaseUrl = "http://www.roblox.com/asset/?id="
LastAttack = 0
Lunging = false

Grips = {
	Up = CFrame.new(0, -1.7, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
	Out = CFrame.new(0, -1.7, 0, 1, 0, 0, 0, 0, -1, -0, 1, 0),
}

Sounds = {
	Unsheath = Handle:WaitForChild("UnsheathSound"),
	Slash = Handle:WaitForChild("SlashSound"),
	Lunge = Handle:WaitForChild("LungeSound"),
}

BasePart = Create("Part"){
	Material = Enum.Material.Plastic,
	Shape = Enum.PartType.Block,
	TopSurface = Enum.SurfaceType.Smooth,
	BottomSurface = Enum.SurfaceType.Smooth,
	FormFactor = Enum.FormFactor.Custom,
	Size = Vector3.new(0.2, 0.2, 0.2),
	CanCollide = true,
	Locked = true,
}

SoulFire = Create("Fire"){
	Name = "Fire",
	Color = Color3.new((255 / 255), (0 / 255), (0 / 255)),
	SecondaryColor = Color3.new((85 / 255), (0 / 255), (0 / 255)),
	Heat = 18,
	Size = 2.5,
	Enabled = true,
}
SoulLight = Create("PointLight"){
	Name = "Light",
	Color = SoulFire.Color,
	Brightness = 35,
	Range = 4,
	Shadows = false,
	Enabled = true,
}

Gravity = 196.20

SwordDamage = 25

ToolEquipped = false

ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
	Name = "ServerControl",
	Parent = Tool,
})

ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
	Name = "ClientControl",
	Parent = Tool,
})

Tool.Grip = Grips.Up
Tool.Enabled = true

function IsTeamMate(Player1, Player2)
	local myteam = Player1.TeamColor
	local theirteam = Player2.TeamColor
	return not (myteam ~= theirteam or (myteam == black and theirteam == black))
end

function TagHumanoid(humanoid, player)
	local Creator_Tag = Create("ObjectValue"){
		Name = "creator",
		Value = player,
	}
	Debris:AddItem(Creator_Tag, 2)
	Creator_Tag.Parent = humanoid
end

function UntagHumanoid(humanoid)
	for i, v in pairs(humanoid:GetChildren()) do
		if v:IsA("ObjectValue") and v.Name == "creator" then
			v:Destroy()
		end
	end
end

function Blow(Part, Damage)
	local PartTouched
	PartTouched = Part.Touched:connect(function(Hit)
		if not Hit or not Hit.Parent or not CheckIfAlive() then
			return
		end
		local RightArm = Character:FindFirstChild("Right Arm")
		if not RightArm then
			return
		end
		local RightGrip = RightArm:FindFirstChild("RightGrip")
		if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
			return
		end
		local character = Hit.Parent
		if character == Character then
			return
		end
		local humanoid = character:FindFirstChild("Humanoid")
		if not humanoid or humanoid.Health == 0 then
			return
		end
		local player = Players:GetPlayerFromCharacter(character)
		if player and (player == Player or IsTeamMate(Player, player)) then
			return
		end
		local HealthAfter = (humanoid.Health - Damage)
		UntagHumanoid(humanoid)
		TagHumanoid(humanoid, Player)
		humanoid:TakeDamage(Damage)
		spawn(function()
			humanoid.WalkSpeed = 9
			wait(1.25)
			humanoid.WalkSpeed = 16
		end)
	end)
	return PartTouched
end

function CreateTrail(Damage, TrailRate)
	local TrailLoop
	local Count = Create("IntValue"){
		Value = 0,
	}
	local Enabled = Create("BoolValue"){
		Value = true,
	}
	spawn(function()
		while Enabled.Value and ToolEquipped and CheckIfAlive() do
			local TrailPart = Handle:Clone()
			TrailPart.Name = "Effect"
			TrailPart.CanCollide = false
			TrailPart.Anchored = true
			Blow(TrailPart, 5)
			Count.Value = (Count.Value + 1)
			Debris:AddItem(TrailPart, 1)
			TrailPart.Parent = game:GetService("Workspace")
			TrailPart.CFrame = Handle.CFrame
			wait(TrailRate)
		end
	end)
	return {Connection = TrailLoop, Count = Count, Enabled = Enabled}
end

function Lunge()
	Lunging = true
	local Target = InvokeClient("MousePosition")
	if not Target then
		return
	end
	local TargetPosition = Target.Position
	local Direction = (CFrame.new(Torso.Position, TargetPosition).lookVector * Vector3.new(1, 0, 1))
	Tool.Grip = Grips.Out
	Sounds.Lunge:Play()
	if Direction.Magnitude > .01 then
		Direction = Direction.Unit 
		local NewBV = Create("BodyVelocity"){
			P = 100000,
			maxForce = Vector3.new(100000, 0, 100000),
			velocity = (Direction * 50),
		}
		Debris:AddItem(NewBV, 0.75)
		NewBV.Parent = Torso
		Torso.CFrame = CFrame.new(Torso.Position, (TargetPosition * Vector3.new(1, 0, 1) + Vector3.new(0, Torso.Position.Y, 0)))
	end
	spawn(function()
		local LungeTrail = CreateTrail(5, 0.08)
		while Lunging and CheckIfAlive() and ToolEquipped do
			RunService.Stepped:wait()
		end
		LungeTrail.Enabled.Value = false
	end)
	wait(0.75)
	Lunging = false 
	Tool.Grip = Grips.Up
	wait(0.5)
end

function Attack()	
	Tool.Grip = Grips.Up
	Sounds.Slash:Play()
	local Anim = Create("StringValue"){
		Name = "toolanim",
		Value = "Slash",
		Parent = Tool,
	}
	spawn(function()
		local AttackTrail = CreateTrail(5, 0.06)
		while AttackTrail.Count.Value < 4 and CheckIfAlive() and ToolEquipped do
			RunService.Stepped:wait()
		end
		AttackTrail.Enabled.Value = false
	end)
	Tool.Grip = Grips.Up
end

function ConsumeTarget(character, number)
	local Part = BasePart:Clone()
	Part.Name = "Effect"
	Part.Transparency = 1
	Part.Size = Vector3.new(0.5, 0.5, 0.5)
	Part.CanCollide = false
	local Fire = SoulFire:Clone()
	Fire.Size = 1
	Fire.Enabled = true
	Fire.Parent = Part
	local Light = SoulLight:Clone()
	Light.Color = Fire.Color
	Light.Enabled = true
	Light.Parent = Part
	if number and number < 3 then
		number = 3
	end
	if character then
		local torso = character:FindFirstChild("Torso")
		if torso then
			number = (number or 4)
			for i = 1, number do
				local Part2 = Part:Clone()
				Part2.CFrame = (Torso.CFrame + Torso.CFrame.lookVector * 4)
				local Propulsion = Create("RocketPropulsion"){
					Target = torso,
					TargetOffset = Vector3.new(0, 2, 0),
					ThrustP = 500,
					ThrustD = 5,
					MaxSpeed = 150,
					MaxTorque = Vector3.new(4000000, 4000000, 0),
					Parent = Part2,
				}
				Debris:AddItem(Part2, 15)
				Part2.Parent = game:GetService("Workspace")
				Propulsion.ReachedTarget:connect(function()
					if not CheckIfAlive() then
						return
					end
					if Part2 and Part2.Parent then
						Part2:Destroy()
					end
				end)
				Propulsion:Fire()
				wait(0.25)
			end
		end
	else
		local TargetPosition = InvokeClient("MousePosition")
		if TargetPosition then
			TargetPosition = TargetPosition.Position
			local Direction = (TargetPosition - Torso.Position).Unit
			for i = 1, 5 do
				local Part2 = Part:Clone()
				Part2.CFrame = (Torso.CFrame + Torso.CFrame.lookVector * 4)
				local Velocity = (Direction * 150)
				local Mass = (Part2:GetMass() * Gravity)
				local BF = Create("BodyForce"){
					Parent = Part2,
					force = Vector3.new(0, Part2:GetMass() * 196.2, 0),
				}
				Part2.Velocity = Velocity
				Part2.Touched:connect(function(Hit)
					if not Hit or not Hit.Parent then
						return
					end
					local character = Hit.Parent
					if character:IsA("Hat") then
						character = Hit.Parent
					end
					local humanoid = character:FindFirstChild("Humanoid")
					if not humanoid or humanoid.Health == 0 then
						return
					end
					local player = Players:GetPlayerFromCharacter(character)
					if player and (Player == player or IsTeamMate(Player, player)) then
						return
					end
					if Part2 and Part2.Parent then
						Part2:Destroy()
					end
				end)
				Debris:AddItem(Part2, 15)
				Part2.Parent = game:GetService("Workspace")
			end
		end
	end
end

function CheckIfAlive()
	return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end

function Activated()
	if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
		return
	end
	Tool.Enabled = false 
	local Time = RunService.Stepped:wait()
	if (Time - LastAttack) < 0.2 then
		Lunge()
	else
		Attack()
	end
	LastAttack = Time
	Tool.Enabled = true
end

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	Torso = Character:FindFirstChild("Torso")
	if not CheckIfAlive() then
		return
	end
	ToolEquipped = true
	spawn(function()
		local CurrentlyEquipped = true
		ToolUnequipped1 = Tool.Unequipped:connect(function()
			CurrentlyEquipped = false
			if ToolUnequipped1 then
				ToolUnequipped1:disconnect()
			end
		end)
		Sounds.Unsheath:Play()
		Humanoid.WalkSpeed = 18
		spawn(function()
			while ToolEquipped and CurrentlyEquipped and CheckIfAlive() do
				wait(1)
				if not ToolEquipped or not CurrentlyEquipped or not CheckIfAlive() then
					break
				end
				Humanoid.Health = (Humanoid.Health + 0.25)
			end
		end)
	end)
end

function Unequipped()
	--[[for i, v in pairs(Sounds) do
		v:Stop()
	end]]
	if CheckIfAlive() then
		--SetPlayerMaxHealth(Humanoid, 100)
		Humanoid.WalkSpeed = 16
	end
	Tool.Grip = Grips.Up
	ToolEquipped = false
end

function InvokeClient(Mode, Value)
	local ClientReturn = nil
	pcall(function()
		ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
	end)
	return ClientReturn
end

Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)

Blow(Handle, SwordDamage)
