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 DamageValues={BaseDamage=11,SlashDamage=18;LungeDamage=22}Multiplier={Kills={Current=0;Max=3};Damage=1.25}FireParticle=script:WaitForChild("\070\105\114\101")DeathEffect=script:WaitForChild("\068\101\097\116\104\069\102\102\101\099\116")Damage=DamageValues.BaseDamage 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"BasePart=Instance.new("\080\097\114\116")BasePart.Shape=Enum.PartType.Block BasePart.Material=Enum.Material.Plastic BasePart.TopSurface=Enum.SurfaceType.Smooth BasePart.BottomSurface=Enum.SurfaceType.Smooth BasePart.FormFactor=Enum.FormFactor.Custom BasePart.Size=Vector3.new(.2,.2,.2)BasePart.CanCollide=true BasePart.Locked=true BasePart.Anchored=false Animations={Equip={Animation=Tool:WaitForChild("\069\113\117\105\112"),FadeTime=nil;Weight=nil;Speed=.7;Duration=1};LeftSlash={Animation=Tool:WaitForChild("\076\101\102\116\083\108\097\115\104"),FadeTime=nil;Weight=nil,Speed=1.5,Duration=.75};RightSlash={Animation=Tool:WaitForChild("\082\105\103\104\116\083\108\097\115\104");FadeTime=nil;Weight=nil;Speed=1.5;Duration=.75};SideSwipe={Animation=Tool:WaitForChild("\083\105\100\101\083\119\105\112\101"),FadeTime=nil,Weight=nil;Speed=.8;Duration=.75}}Sounds={Unsheath=Handle:WaitForChild("\085\110\115\104\101\097\116\104"),Slash=Handle:WaitForChild("\083\108\097\115\104");Lunge=Handle:WaitForChild("\076\117\110\103\101")}Grips={Up=CFrame.new(0,-1.25,0,1,0,0,0,1,0,0,0,1),Out=CFrame.new(0,-1.25,0,1,0,0,0,0,-1,0,1,0)}LastAttack=0 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})Handle.Transparency=0 Tool.Grip=Grips.Up Tool.Enabled=true function Clamp(i,c,K)return math.max(math.min(K,i),c)end function GetPercentage(i,c,K)return((K-i)/(c-i))*100 end function Round(i,c)local K,J=math.modf(i)return J>=c and math.ceil(i)or J<c and math.floor(i)end function IsTeamMate(i,c)return i and(c and(not i.Neutral and(not c.Neutral and i.TeamColor==c.TeamColor)))end function TagHumanoid(i,c)local K=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114";Value=c})Debris:AddItem(K,2)K.Parent=i end function UntagHumanoid(i)for i,c in pairs(i:GetChildren())do if c:IsA("\079\098\106\101\099\116\086\097\108\117\101")and c.Name=="\099\114\101\097\116\111\114"then c:Destroy()end end end function ApplyDeathEffect(i,c,K)local J=c or Vector3.new(0,0,0)local Q=K or Vector3.new(0,0,0)local o=i:FindFirstChild("\072\117\109\097\110\111\105\100")if not o then return end local D=i:FindFirstChild(DeathEffect.Name)if D then return end D=DeathEffect:Clone()D.WindDirection.Value=J D.Force.Value=Q D.Disabled=false D.Parent=i end function DealDamage(i,c)if not CheckIfAlive()or not i then return end local K=c or 0 local J=i:FindFirstChild("\072\117\109\097\110\111\105\100")local Q=i:FindFirstChild("\084\111\114\115\111")if not J or J.Health==0 or not Q then return end UntagHumanoid(J)TagHumanoid(J,Player)J:TakeDamage(K)if J.Health<=0 then if Multiplier.Kills.Current<Multiplier.Kills.Max then Multiplier.Kills.Current=Multiplier.Kills.Current+1 Delay(15,function()Multiplier.Kills.Current=Multiplier.Kills.Current-1 end)end local c=(CFrame.new(Torso.Position,Vector3.new(Q.Position.X,Torso.Position.Y,Q.Position.Z))*CFrame.Angles(0,math.pi,0)).lookVector ApplyDeathEffect(i,Vector3.new(c.X,1,c.Z),c*6.5+Vector3.new(0,15,0))end end function CheckIfAlive()return(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and Humanoid.Health>0))))and true or false end function Blow(i)local c local K=false c=i.Touched:connect(function(i)if not i or not i.Parent or not CheckIfAlive()or not ToolEquipped or K then return end local c=Character:FindFirstChild("\082\105\103\104\116 \065\114\109")if not c then return end local J=c:FindFirstChild("\082\105\103\104\116\071\114\105\112")if not J or J.Part0~=Handle and J.Part1~=Handle then return end local Q=i.Parent if Q==Character then return end local o=Q:FindFirstChild("\072\117\109\097\110\111\105\100")local D=Q:FindFirstChild("\084\111\114\115\111")if not o or o.Health==0 or not D then return end local g=Players:GetPlayerFromCharacter(Q)if g and(g==Player or IsTeamMate(Player,g))then return end K=true local B=Clamp(GetPercentage(0,Multiplier.Kills.Max,Multiplier.Kills.Current),0,100)*.01 local X=Damage*(Multiplier.Damage*B)local V=Damage+X print(X)DealDamage(Q,V)wait(.05)K=false end)end function Attack()Damage=DamageValues.SlashDamage Sounds.Slash:Play()local i={Animations.LeftSlash,Animations.RightSlash,Animations.SideSwipe;Animations.Swing}local c=i[math.random(1,#i)]Spawn(function()InvokeClient("\080\108\097\121\065\110\105\109\097\116\105\111\110",c)end)end function Lunge()Damage=DamageValues.LungeDamage Sounds.Lunge:Play()for i,c in pairs(Animations)do Spawn(function()InvokeClient("\083\116\111\112\065\110\105\109\097\116\105\111\110",c)end)end local i=(Create("\083\116\114\105\110\103\086\097\108\117\101"))({Name="\116\111\111\108\097\110\105\109",Value="\076\117\110\103\101"})Debris:AddItem(i,2)i.Parent=Tool wait(.2)Tool.Grip=Grips.Out wait(.75)Tool.Grip=Grips.Up Damage=DamageValues.SlashDamage end function Activated()if not Tool.Enabled or not ToolEquipped or not CheckIfAlive()then return end Tool.Enabled=false local i=RunService.Stepped:wait()if i-LastAttack<.2 then Lunge()else Attack()end LastAttack=i Damage=DamageValues.BaseDamage Tool.Enabled=true end function CreateParticlePart(i)for i,c in pairs(Tool:GetChildren())do if c:IsA("\066\097\115\101\080\097\114\116")and c~=Handle then c:Destroy()end end if not i then return end ParticlePart=BasePart:Clone()ParticlePart.Name="\069\102\102\101\099\116"ParticlePart.Transparency=1 ParticlePart.Size=Vector3.new(.2,2.5,.5)ParticlePart.CanCollide=false FireParticleCopy=FireParticle:Clone()FireParticleCopy.Enabled=true FireParticleCopy.Parent=ParticlePart;(Create("\087\101\108\100"))({Name="\087\101\108\100",Part0=Handle;Part1=ParticlePart;C0=CFrame.new(0,.625,0),C1=CFrame.new(0,0,0),Parent=ParticlePart})ParticlePart.Parent=Tool end function CheckIfAlive()return(Player and(Player.Parent and(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and(Humanoid.Health>0 and(Torso and Torso.Parent))))))))and true or false 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 Sounds.Unsheath:Play()Spawn(function()if ToolUnequipped then ToolUnequipped:disconnect()end local i=true ToolUnequipped=Tool.Unequipped:connect(function()i=false end)local c=Animations.Equip Spawn(function()InvokeClient("\080\108\097\121\065\110\105\109\097\116\105\111\110",c)end)wait(c.Duration)if ToolUnequipped then ToolUnequipped:disconnect()end if not i then return end ToolEquipped=true Humanoid.WalkSpeed=20.0 CreateParticlePart(true)end)end function Unequipped()Humanoid.WalkSpeed=16 Spawn(function()CreateParticlePart(false)end)ToolEquipped=false end function OnServerInvoke(i,c,K)if i~=Player or not ToolEquipped or not K or not CheckIfAlive()then return end end function InvokeClient(i,c)local K=nil pcall(function()K=ClientControl:InvokeClient(Player,i,c)end)return K end ServerControl.OnServerInvoke=OnServerInvoke Delay(0,function()if not ToolEquipped then CreateParticlePart(false)end end)Tool.Activated:connect(Activated)Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)Blow(Handle)


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

DamageValues = {
	BaseDamage = 11,
	SlashDamage = 18,
	LungeDamage = 22,
}

Multiplier = {
	Kills = {Current = 0, Max = 3},
	Damage = 1.25,
}

FireParticle = script:WaitForChild("Fire")
DeathEffect = script:WaitForChild("DeathEffect")

Damage = DamageValues.BaseDamage

BaseUrl = "http://www.roblox.com/asset/?id="

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

Animations = {
	Equip = {Animation = Tool:WaitForChild("Equip"), FadeTime = nil, Weight = nil, Speed = 0.7, Duration = 1},
	LeftSlash = {Animation = Tool:WaitForChild("LeftSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.75},
	RightSlash = {Animation = Tool:WaitForChild("RightSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.75},
	SideSwipe = {Animation = Tool:WaitForChild("SideSwipe"), FadeTime = nil, Weight = nil, Speed = 0.8, Duration = 0.75},
}

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

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

LastAttack = 0

ToolEquipped = false

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

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

Handle.Transparency = 0
Tool.Grip = Grips.Up
Tool.Enabled = true

function Clamp(Number, Min, Max)
	return math.max(math.min(Max, Number), Min)
end

function GetPercentage(Start, End, Number)
	return (((Number - Start) / (End - Start)) * 100)
end

function Round(Number, RoundDecimal)
	local WholeNumber, Decimal = math.modf(Number)
	return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
end

function IsTeamMate(Player1, Player2)
	return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
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 ApplyDeathEffect(character, Direction, Force)
	local Direction = (Direction or Vector3.new(0, 0, 0))
	local Force = (Force or Vector3.new(0, 0, 0))
	local humanoid = character:FindFirstChild("Humanoid")
	if not humanoid then
		return
	end
	local DeathEffectCopy = character:FindFirstChild(DeathEffect.Name)
	if DeathEffectCopy then
		return
	end
	DeathEffectCopy = DeathEffect:Clone()
	DeathEffectCopy.WindDirection.Value = Direction
	DeathEffectCopy.Force.Value = Force
	DeathEffectCopy.Disabled = false
	DeathEffectCopy.Parent = character
end

function DealDamage(character, damage)
	if not CheckIfAlive() or not character then
		return
	end
	local damage = (damage or 0)
	local humanoid = character:FindFirstChild("Humanoid")
	local torso = character:FindFirstChild("Torso")
	if not humanoid or humanoid.Health == 0 or not torso then
		return
	end
	UntagHumanoid(humanoid)
	TagHumanoid(humanoid, Player)
	humanoid:TakeDamage(damage)
	if humanoid.Health <= 0 then
		if Multiplier.Kills.Current < Multiplier.Kills.Max then
			Multiplier.Kills.Current = (Multiplier.Kills.Current + 1)
			Delay(15, (function()
				Multiplier.Kills.Current = (Multiplier.Kills.Current - 1)
			end))
		end
		local WindDir = (CFrame.new(Torso.Position, Vector3.new(torso.Position.X, Torso.Position.Y, torso.Position.Z)) * CFrame.Angles(0, math.pi, 0)).lookVector
		ApplyDeathEffect(character, Vector3.new(WindDir.X, 1, WindDir.Z), ((WindDir * 6.5) + Vector3.new(0, 15, 0)))
	end
end

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

function Blow(Part)
	local PartTouched
	local HitDelay = false
	PartTouched = Part.Touched:connect(function(Hit)
		if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped or HitDelay 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")
		local torso = character:FindFirstChild("Torso")
		if not humanoid or humanoid.Health == 0 or not torso then
			return
		end
		local player = Players:GetPlayerFromCharacter(character)
		if player and (player == Player or IsTeamMate(Player, player)) then
			return
		end
		HitDelay = true
		local ChargePercent = (Clamp(GetPercentage(0, Multiplier.Kills.Max, Multiplier.Kills.Current), 0, 100) * 0.01)
		local BonusDamage = (Damage * (Multiplier.Damage * ChargePercent))
		local TotalDamage = (Damage + BonusDamage)
		print(BonusDamage)
		DealDamage(character, TotalDamage)
		wait(0.05)
		HitDelay = false
	end)
end

function Attack()
	Damage = DamageValues.SlashDamage
	Sounds.Slash:Play()
	--[[local Anim = Create("StringValue"){
		Name = "toolanim",
		Value = "Slash",
	}
	Debris:AddItem(Anim, 2)
	Anim.Parent = Tool]]
	local SwingAnimations = {Animations.LeftSlash, Animations.RightSlash, Animations.SideSwipe, Animations.Swing}
	local Animation = SwingAnimations[math.random(1, #SwingAnimations)]
	Spawn(function()
		InvokeClient("PlayAnimation", Animation)
	end)
end

function Lunge()
	Damage = DamageValues.LungeDamage
	Sounds.Lunge:Play()
	for i, v in pairs(Animations) do
		Spawn(function()
			InvokeClient("StopAnimation", v)
		end)
	end
	local Anim = Create("StringValue"){
		Name = "toolanim",
		Value = "Lunge",
	}
	Debris:AddItem(Anim, 2)
	Anim.Parent = Tool
	wait(0.2)
	Tool.Grip = Grips.Out
	wait(0.75)
	Tool.Grip = Grips.Up
	Damage = DamageValues.SlashDamage
end

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

function CreateParticlePart(MakeNew)
	for i, v in pairs(Tool:GetChildren()) do
		if v:IsA("BasePart") and v ~= Handle then
			v:Destroy()
		end
	end
	if not MakeNew then
		return
	end
	ParticlePart = BasePart:Clone()
	ParticlePart.Name = "Effect"
	ParticlePart.Transparency = 1
	ParticlePart.Size = Vector3.new(0.2, 2.5, 0.5)
	ParticlePart.CanCollide = false
	FireParticleCopy = FireParticle:Clone()
	FireParticleCopy.Enabled = true
	FireParticleCopy.Parent = ParticlePart
	Create("Weld"){
		Name = "Weld",
		Part0 = Handle,
		Part1 = ParticlePart,
		C0 = CFrame.new(0, 0.625, 0),
		C1 = CFrame.new(0, 0, 0),
		Parent = ParticlePart,
	}
	ParticlePart.Parent = Tool
end

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

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	Torso = Character:FindFirstChild("Torso")
	if not CheckIfAlive() then
		return
	end
	Sounds.Unsheath:Play()
	Spawn(function()
		if ToolUnequipped then
			ToolUnequipped:disconnect()
		end
		local CurrentlyEquipped = true
		ToolUnequipped = Tool.Unequipped:connect(function()
			CurrentlyEquipped = false
		end)
		local Animation = Animations.Equip
		Spawn(function()
			InvokeClient("PlayAnimation", Animation)
		end)
		wait(Animation.Duration)
		if ToolUnequipped then
			ToolUnequipped:disconnect()
		end
		if not CurrentlyEquipped then
			return
		end
		ToolEquipped = true
		Humanoid.WalkSpeed = (16 * 1.25)
		CreateParticlePart(true)
	end)
end

function Unequipped()
	Humanoid.WalkSpeed = 16
	Spawn(function()
		CreateParticlePart(false)
	end)
	ToolEquipped = false
end

function OnServerInvoke(player, mode, value)
	if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
		return
	end
end

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

ServerControl.OnServerInvoke = OnServerInvoke

Delay(0, (function()
	if not ToolEquipped then
		CreateParticlePart(false)
	end
end))

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

Blow(Handle)
