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=20,SlashDamage=35}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={LeftSlash={Animation=Tool:WaitForChild("\076\101\102\116\083\108\097\115\104"),FadeTime=nil,Weight=nil;Speed=1.5;Duration=.5};RightSlash={Animation=Tool:WaitForChild("\082\105\103\104\116\083\108\097\115\104"),FadeTime=nil;Weight=nil;Speed=1.5;Duration=.5},SideSwipe={Animation=Tool:WaitForChild("\083\105\100\101\083\119\105\112\101");FadeTime=nil;Weight=nil;Speed=.8,Duration=.5};R15LeftSlash={Animation=Tool:WaitForChild("\082\049\053\076\101\102\116\083\108\097\115\104"),FadeTime=nil,Weight=nil;Speed=1.5;Duration=.5},R15RightSlash={Animation=Tool:WaitForChild("\082\049\053\082\105\103\104\116\083\108\097\115\104"),FadeTime=nil;Weight=nil,Speed=1.5,Duration=.5},R15SideSwipe={Animation=Tool:WaitForChild("\082\049\053\083\105\100\101\083\119\105\112\101");FadeTime=nil,Weight=nil,Speed=.8,Duration=.5}}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")}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.Enabled=true function IsTeamMate(n,D)return n and(D and(not n.Neutral and(not D.Neutral and n.TeamColor==D.TeamColor)))end function TagHumanoid(n,D)local i=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114";Value=D})Debris:AddItem(i,2)i.Parent=n end function UntagHumanoid(n)for n,D in pairs(n:GetChildren())do if D:IsA("\079\098\106\101\099\116\086\097\108\117\101")and D.Name=="\099\114\101\097\116\111\114"then D:Destroy()end end end function DealDamage(n,D)if not CheckIfAlive()or not n then return end local i=D or 0 local E=n:FindFirstChild("\072\117\109\097\110\111\105\100")local L=n:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")if not L then L=n:FindFirstChild("\084\111\114\115\111")end if not E or E.Health==0 or not L then return end UntagHumanoid(E)TagHumanoid(E,Player)if E.Parent.Side.Value=="\069\110\101\109\121"then E:TakeDamage(i)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(n)local D local i=false D=n.Touched:connect(function(n)if not n or not n.Parent or not CheckIfAlive()or not ToolEquipped or i then return end local D=Character:FindFirstChild("\082\105\103\104\116 \065\114\109")or Character:FindFirstChild("\082\105\103\104\116\072\097\110\100")if not D then return end local E=D:FindFirstChild("\082\105\103\104\116\071\114\105\112")if not E or E.Part0~=Handle and E.Part1~=Handle then return end local L=n.Parent if L==Character then return end local W=L:FindFirstChild("\072\117\109\097\110\111\105\100")local X=L:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or L:FindFirstChild("\084\111\114\115\111")if not W or W.Health==0 or not X then return end local A=Players:GetPlayerFromCharacter(L)if A and(A==Player or IsTeamMate(Player,A))then return end i=true local s=Damage DealDamage(L,s)wait(.05)i=false end)end function Attack()Damage=DamageValues.SlashDamage Sounds.Slash:Play()local n=Humanoid.RigType==Enum.HumanoidRigType.R6 and{Animations.LeftSlash;Animations.RightSlash;Animations.SideSwipe}or Humanoid.RigType==Enum.HumanoidRigType.R15 and{Animations.R15LeftSlash,Animations.R15SideSwipe}local D=n[math.random(1,#n)]Spawn(function()InvokeClient("\080\108\097\121\065\110\105\109\097\116\105\111\110",D)end)wait(D.Duration)end function Activated()if not Tool.Enabled or not ToolEquipped or not CheckIfAlive()then return end Tool.Enabled=false Attack()Damage=DamageValues.BaseDamage Tool.Enabled=true end function CheckIfAlive()return(Player and(Player.Parent and(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and(Humanoid.Health>0 and(RootPart and RootPart.Parent))))))))and true or false end holdanim=nil 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")holdanim=Humanoid:LoadAnimation(script.Parent.Hold)if not CheckIfAlive()then return end Sounds.Unsheath:Play()holdanim:Play()ToolEquipped=true end function Unequipped()Humanoid.WalkSpeed=16 ToolEquipped=false holdanim:Stop()end function OnServerInvoke(n,D,i)if n~=Player or not ToolEquipped or not i or not CheckIfAlive()then return end end function InvokeClient(n,D)local i=nil pcall(function()i=ClientControl:InvokeClient(Player,n,D)end)return i end ServerControl.OnServerInvoke=OnServerInvoke Tool.Activated:connect(Activated)Tool.Equipped:connect(Equipped)Tool.Unequipped:connect(Unequipped)Blow(Handle)
--Made by Luckymaxer
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 = 20,
	SlashDamage = 35,
}

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 = {
	LeftSlash = {
		Animation = Tool:WaitForChild("LeftSlash"),
		FadeTime = nil,
		Weight = nil,
		Speed = 1.5,
		Duration = 0.5,
	},
	RightSlash = {
		Animation = Tool:WaitForChild("RightSlash"),
		FadeTime = nil,
		Weight = nil,
		Speed = 1.5,
		Duration = 0.5,
	},
	SideSwipe = {
		Animation = Tool:WaitForChild("SideSwipe"),
		FadeTime = nil,
		Weight = nil,
		Speed = 0.8,
		Duration = 0.5,
	},
	R15LeftSlash = {
		Animation = Tool:WaitForChild("R15LeftSlash"),
		FadeTime = nil,
		Weight = nil,
		Speed = 1.5,
		Duration = 0.5,
	},
	R15RightSlash = {
		Animation = Tool:WaitForChild("R15RightSlash"),
		FadeTime = nil,
		Weight = nil,
		Speed = 1.5,
		Duration = 0.5,
	},
	R15SideSwipe = {
		Animation = Tool:WaitForChild("R15SideSwipe"),
		FadeTime = nil,
		Weight = nil,
		Speed = 0.8,
		Duration = 0.5,
	},
}

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

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.Enabled = true

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 DealDamage(character, damage)
	if not CheckIfAlive() or not character then
		return
	end
	local damage = (damage or 0)
	local humanoid = character:FindFirstChild("Humanoid")
	local rootpart = character:FindFirstChild("HumanoidRootPart")
	if not rootpart then
		rootpart = character:FindFirstChild("Torso")
	end
	if not humanoid or humanoid.Health == 0 or not rootpart then
		return
	end
	UntagHumanoid(humanoid)
	TagHumanoid(humanoid, Player)
	if humanoid.Parent.Side.Value == "Enemy" then
		humanoid:TakeDamage(damage)
	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") or Character:FindFirstChild("RightHand"))
		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 rootpart = (character:FindFirstChild("HumanoidRootPart") or character:FindFirstChild("Torso"))
		if not humanoid or humanoid.Health == 0 or not rootpart then
			return
		end
		local player = Players:GetPlayerFromCharacter(character)
		if player and (player == Player or IsTeamMate(Player, player)) then
			return
		end
		HitDelay = true
		local TotalDamage = Damage
		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 = (
		(
			Humanoid.RigType == Enum.HumanoidRigType.R6
			and { Animations.LeftSlash, Animations.RightSlash, Animations.SideSwipe }
		)
		or (
			Humanoid.RigType == Enum.HumanoidRigType.R15
			and {
				Animations.R15LeftSlash, --[[Animations.R15RightSlash,]]
				Animations.R15SideSwipe,
			}
		)
	)
	local Animation = SwingAnimations[math.random(1, #SwingAnimations)]
	Spawn(function()
		InvokeClient("PlayAnimation", Animation)
	end)
	wait(Animation.Duration)
end

function Activated()
	if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
		return
	end
	Tool.Enabled = false
	Attack()
	Damage = DamageValues.BaseDamage
	Tool.Enabled = true
end

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

holdanim = nil

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

function Unequipped()
	Humanoid.WalkSpeed = 16
	ToolEquipped = false
	holdanim:Stop()
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

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

Blow(Handle)
