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")black=BrickColor.new("\082\101\097\108\108\121 \098\108\097\099\107")DamageValues={BaseDamage=5,SlashDamage=10,LungeDamage=20}Damage=DamageValues.BaseDamage Sounds={Slash=Handle:WaitForChild("\083\119\111\114\100\083\108\097\115\104");Lunge=Handle:WaitForChild("\083\119\111\114\100\076\117\110\103\101");Unsheath=Handle:WaitForChild("\085\110\115\104\101\097\116\104")}Animations={Slash=Tool:WaitForChild("\083\108\097\115\104");R15Slash=Tool:WaitForChild("\082\049\053\083\108\097\115\104")}ClientControl=Tool:FindFirstChild("\067\108\105\101\110\116\067\111\110\116\114\111\108")or Instance.new("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")ClientControl.Name="\067\108\105\101\110\116\067\111\110\116\114\111\108"ClientControl.Parent=Tool function InvokeClient(b,Q)pcall(function()ClientControl:InvokeClient(Player,b,Q)end)end function TagHumanoid(b,Q)local O=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")O.Name="\099\114\101\097\116\111\114"O.Value=Q Debris:AddItem(O,2)O.Parent=b end function UntagHumanoid(b)for b,Q in pairs(b:GetChildren())do if Q:IsA("\079\098\106\101\099\116\086\097\108\117\101")and Q.Name=="\099\114\101\097\116\111\114"then Q:Destroy()end end end function Blow(b)if not b or not b.Parent or not Character or not Humanoid or Humanoid.Health==0 then return end local Q=b.Parent:FindFirstChildOfClass("\072\117\109\097\110\111\105\100")if Q and(Q~=Humanoid and Q.Health>0)then local O=Character:FindFirstChild("\082\105\103\104\116 \065\114\109")or Character:FindFirstChild("\082\105\103\104\116\072\097\110\100")if not O then return end local o=game.Players:FindFirstChild(b.Parent.Name)local w=Player.TeamColor local K=o.TeamColor local I=O:FindFirstChild("\082\105\103\104\116\071\114\105\112")if I and(I.Part0==Handle or I.Part1==Handle)then if o and(o~=Player and(not Player.Neutral and(not o.Neutral and(w~=K or w==black and K==black))))then UntagHumanoid(Q)TagHumanoid(Q,Player)Q:TakeDamage(Damage)end end end end function Attack()Damage=DamageValues.SlashDamage Sounds.Slash:Play()local b=Animations.Slash if Humanoid and Humanoid.RigType==Enum.HumanoidRigType.R15 then b=Animations.R15Slash end InvokeClient("\080\108\097\121\065\110\105\109\097\116\105\111\110",{Animation=b;Speed=1.5})end function Lunge()Damage=DamageValues.LungeDamage Sounds.Lunge:Play()local b=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")b.Name="\116\111\111\108\097\110\105\109"b.Value="\076\117\110\103\101"b.Parent=Tool local Q=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")if Torso and Torso.Parent then Q.velocity=Vector3.new(0,100,0)Q.maxForce=Vector3.new(0,4000,0)Debris:AddItem(Q,.25)Q.Parent=Torso end wait(.25)if Torso and Torso.Parent then Q.velocity=Torso.CFrame.lookVector*120+Vector3.new(0,60,0)end wait(.5)if Q and Q.Parent then Q:Destroy()end wait(.5)Damage=DamageValues.SlashDamage end Tool.Enabled=true LastAttack=0 function Activated()if not Tool.Enabled then return end Tool.Enabled=false Tick=RunService.Stepped:wait()if Tick-LastAttack<.2 then Lunge()else Attack()end LastAttack=Tick 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")or Character:FindFirstChild("\085\112\112\101\114\084\111\114\115\111")if not Player or not Humanoid or Humanoid.Health==0 or not Torso then return end Sounds.Unsheath:Play()end Tool.Activated:connect(Activated)Tool.Equipped:connect(Equipped)Connection=Handle.Touched:connect(Blow)
--Fixed by Luckymaxer
--Updated for R15 Avatars by StarWars

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

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

black = BrickColor.new("Really black")

DamageValues = {
	BaseDamage = 5,
	SlashDamage = 10,
	LungeDamage = 20,
}

Damage = DamageValues.BaseDamage

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

Animations = {
	Slash = Tool:WaitForChild("Slash"),
	R15Slash = Tool:WaitForChild("R15Slash"),
}

ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool

function InvokeClient(Mode, Value)
	pcall(function()
		ClientControl:InvokeClient(Player, Mode, Value)
	end)
end

function TagHumanoid(humanoid, player)
	local Creator_Tag = Instance.new("ObjectValue")
	Creator_Tag.Name = "creator"
	Creator_Tag.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(Hit)
	if not Hit or not Hit.Parent or not Character or not Humanoid or Humanoid.Health == 0 then
		return
	end
	local humanoid = Hit.Parent:FindFirstChildOfClass("Humanoid")
	if humanoid and humanoid ~= Humanoid and humanoid.Health > 0 then
		local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
		if not RightArm then
			return
		end
		local player = game.Players:FindFirstChild(Hit.Parent.Name)
		local myteam = Player.TeamColor
		local theirteam = player.TeamColor
		local RightGrip = RightArm:FindFirstChild("RightGrip")
		if RightGrip and (RightGrip.Part0 == Handle or RightGrip.Part1 == Handle) then
			if
				player
				and player ~= Player
				and not Player.Neutral
				and not player.Neutral
				and (myteam ~= theirteam or (myteam == black and theirteam == black))
			then
				UntagHumanoid(humanoid)
				TagHumanoid(humanoid, Player)
				humanoid:TakeDamage(Damage)
			end
		end
	end
end

function Attack()
	Damage = DamageValues.SlashDamage
	Sounds.Slash:Play()
	local Animation = Animations.Slash
	if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
		Animation = Animations.R15Slash
	end
	InvokeClient("PlayAnimation", { Animation = Animation, Speed = 1.5 })
end

function Lunge()
	Damage = DamageValues.LungeDamage

	Sounds.Lunge:Play()

	local Anim = Instance.new("StringValue")
	Anim.Name = "toolanim"
	Anim.Value = "Lunge"
	Anim.Parent = Tool

	local Force = Instance.new("BodyVelocity")
	if Torso and Torso.Parent then
		Force.velocity = Vector3.new(0, 100, 0)
		Force.maxForce = Vector3.new(0, 4000, 0)
		Debris:AddItem(Force, 0.25)
		Force.Parent = Torso
	end

	wait(0.25)

	if Torso and Torso.Parent then
		Force.velocity = (Torso.CFrame.lookVector * 120) + Vector3.new(0, 60, 0)
	end

	wait(0.5)

	if Force and Force.Parent then
		Force:Destroy()
	end

	wait(0.5)

	Damage = DamageValues.SlashDamage
end

Tool.Enabled = true
LastAttack = 0

function Activated()
	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	Tick = RunService.Stepped:wait()

	if Tick - LastAttack < 0.2 then
		Lunge()
	else
		Attack()
	end

	LastAttack = Tick

	--wait(0.5)

	Tool.Enabled = true
end

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
	if not Player or not Humanoid or Humanoid.Health == 0 or not Torso then
		return
	end
	Sounds.Unsheath:Play()
end

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

Connection = Handle.Touched:connect(Blow)
