Tool=script.Parent Handle=Tool:WaitForChild("\072\097\110\100\108\101")Mesh=Handle:WaitForChild("\077\101\115\104")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")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"Grips={Up=CFrame.new(0,0,-1.5,0,0,1,1,0,0,0,1,0),Out=CFrame.new(0,0,-1.5,0,-1,0,-1,0,0,0,0,-1)}DamageValues={BaseDamage=5;SlashDamage=10,LungeDamage=30}Damage=DamageValues.BaseDamage Sounds={Slash=Handle:WaitForChild("\083\108\097\115\104");Lunge=Handle:WaitForChild("\076\117\110\103\101"),Unsheath=Handle:WaitForChild("\085\110\115\104\101\097\116\104")}LastAttack=0 ToolEquipped=false Tool.Enabled=true function SwordUp()Tool.Grip=Grips.Up end function SwordOut()Tool.Grip=Grips.Out end function IsTeamMate(m,U)return m and(U and(not m.Neutral and(not U.Neutral and m.TeamColor==U.TeamColor)))end function TagHumanoid(m,U)local q=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")q.Name="\099\114\101\097\116\111\114"q.Value=U Debris:AddItem(q,2)q.Parent=m end function UntagHumanoid(m)for m,U in pairs(m:GetChildren())do if U:IsA("\079\098\106\101\099\116\086\097\108\117\101")and U.Name=="\099\114\101\097\116\111\114"then U:Destroy()end end end function Attack()Damage=DamageValues.SlashDamage Sounds.Slash:Play()local m=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")m.Name="\116\111\111\108\097\110\105\109"m.Value="\083\108\097\115\104"m.Parent=Tool end function Lunge()Damage=DamageValues.LungeDamage Sounds.Lunge:Play()local m=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")m.Name="\116\111\111\108\097\110\105\109"m.Value="\076\117\110\103\101"m.Parent=Tool local U=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")U.velocity=Vector3.new(0,10,0)U.maxForce=Vector3.new(0,4000,0)Debris:AddItem(U,.5)U.Parent=RootPart wait(.25)SwordOut()wait(.25)if U and U.Parent then U:Destroy()end wait(.5)SwordUp()end function Blow(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")or Character:FindFirstChild("\082\105\103\104\116\072\097\110\100")if not U then return end local q=U:FindFirstChild("\082\105\103\104\116\071\114\105\112")if not q or q.Part0~=U and q.Part1~=U or q.Part0~=Handle and q.Part1~=Handle then return end local n=m.Parent local s=n:FindFirstChild("\072\117\109\097\110\111\105\100")if not s then return end local Q=Players:GetPlayerFromCharacter(n)if Q and(Q==Player or IsTeamMate(Player,Q))then return end UntagHumanoid(s)TagHumanoid(s,Player)s:TakeDamage(Damage)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 Damage=DamageValues.BaseDamage LastAttack=m Tool.Enabled=true end function CheckIfAlive()return(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and(Humanoid.Health>0 and(RootPart and(RootPart.Parent and(Player and Player.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")RootPart=Character:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if not CheckIfAlive()then return end ToolEquipped=true Sounds.Unsheath:Play()end function Unequipped()ToolEquipped=false end SwordUp()Handle.Touched:connect(Blow)Tool.Activated:connect(Activated)Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)
--Rescripted by Luckymaxer

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

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

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

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

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

Damage = DamageValues.BaseDamage

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

LastAttack = 0

ToolEquipped = false

Tool.Enabled = true

function SwordUp()
	Tool.Grip = Grips.Up
end

function SwordOut()
	Tool.Grip = Grips.Out
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 = 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 Attack()
	Damage = DamageValues.SlashDamage
	Sounds.Slash:Play()
	local Anim = Instance.new("StringValue")
	Anim.Name = "toolanim"
	Anim.Value = "Slash"
	Anim.Parent = Tool
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")
	Force.velocity = Vector3.new(0, 10, 0)
	Force.maxForce = Vector3.new(0, 4000, 0)
	Debris:AddItem(Force, 0.5)
	Force.Parent = RootPart
	wait(0.25)
	SwordOut()
	wait(0.25)
	if Force and Force.Parent then
		Force:Destroy()
	end
	wait(0.5)
	SwordUp()
end

function Blow(Hit)
	if not Hit or not Hit.Parent or not CheckIfAlive() then
		return
	end
	local RightArm = (Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand"))
	if not RightArm then
		return
	end
	local RightGrip = RightArm:FindFirstChild("RightGrip")
	if
		not RightGrip
		or (RightGrip.Part0 ~= RightArm and RightGrip.Part1 ~= RightArm)
		or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle)
	then
		return
	end
	local character = Hit.Parent
	local humanoid = character:FindFirstChild("Humanoid")
	if not humanoid then
		return
	end
	local player = Players:GetPlayerFromCharacter(character)
	if player and (player == Player or IsTeamMate(Player, player)) then
		return
	end
	UntagHumanoid(humanoid)
	TagHumanoid(humanoid, Player)
	humanoid:TakeDamage(Damage)
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
	Damage = DamageValues.BaseDamage
	LastAttack = Tick
	Tool.Enabled = true
end

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

function Equipped()
	Character = Tool.Parent
	Player = Players:GetPlayerFromCharacter(Character)
	Humanoid = Character:FindFirstChild("Humanoid")
	RootPart = Character:FindFirstChild("HumanoidRootPart")
	if not CheckIfAlive() then
		return
	end
	ToolEquipped = true
	Sounds.Unsheath:Play()
end

function Unequipped()
	ToolEquipped = false
end

SwordUp()

Handle.Touched:connect(Blow)

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