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=10;SlashDamage=20}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 Rate=.016666666666667 AnimationsBin=Tool:WaitForChild("\065\110\105\109\097\116\105\111\110\115")R6Anims=AnimationsBin:WaitForChild("\082\054")R15Anims=AnimationsBin:WaitForChild("\082\049\053")Animations={R6LeftSlash={Animation=R6Anims:WaitForChild("\076\101\102\116\083\108\097\115\104");FadeTime=nil;Weight=nil;Speed=1.5;Duration=.5};R6RightSlash={Animation=R6Anims:WaitForChild("\082\105\103\104\116\083\108\097\115\104"),FadeTime=nil;Weight=nil;Speed=1.5,Duration=.5},R6SideSwipe={Animation=R6Anims:WaitForChild("\083\105\100\101\083\119\105\112\101"),FadeTime=nil,Weight=nil,Speed=.8;Duration=.5};R15LeftSlash={Animation=R15Anims:WaitForChild("\076\101\102\116\083\108\097\115\104"),FadeTime=nil,Weight=nil,Speed=1.5,Duration=.5},R15RightSlash={Animation=R15Anims:WaitForChild("\082\105\103\104\116\083\108\097\115\104"),FadeTime=nil,Weight=nil,Speed=1.5,Duration=.5},R15SideSwipe={Animation=R15Anims:WaitForChild("\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 Remotes=Tool:FindFirstChild("\082\101\109\111\116\101\115")or(Create("\070\111\108\100\101\114"))({Name="\082\101\109\111\116\101\115";Parent=Tool})ServerControl=Remotes: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=Remotes})ClientControl=Remotes: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=Remotes})Handle.Transparency=0 Tool.Enabled=true function IsTeamMate(G,N)return G and(N and(not G.Neutral and(not N.Neutral and G.TeamColor==N.TeamColor)))end function TagHumanoid(G,N)local t=(Create("\079\098\106\101\099\116\086\097\108\117\101"))({Name="\099\114\101\097\116\111\114",Value=N})Debris:AddItem(t,2)t.Parent=G end function UntagHumanoid(G)for G,N in pairs(G:GetChildren())do if N:IsA("\079\098\106\101\099\116\086\097\108\117\101")and N.Name=="\099\114\101\097\116\111\114"then N:Destroy()end end end function CheckTableForInstance(G,N)for G,t in pairs(G)do if t==N then return true end end return false end function DealDamage(G,N)if not CheckIfAlive()or not G then return end local t=N or 0 local c=G:FindFirstChild("\072\117\109\097\110\111\105\100")local j=G:FindFirstChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")or G:FindFirstChild("\084\111\114\115\111")if not c or c.Health==0 or not j then return end UntagHumanoid(c)TagHumanoid(c,Player)c:TakeDamage(t)end function CheckIfAlive()return(Character and(Character.Parent and(Humanoid and(Humanoid.Parent and Humanoid.Health>0))))and true or false end function Blow(G)local N local t=false N=G.Touched:connect(function(G)if not G or not G.Parent or not CheckIfAlive()or not ToolEquipped or t then return end local N=Character:FindFirstChild("\082\105\103\104\116 \065\114\109")or Character:FindFirstChild("\082\105\103\104\116\072\097\110\100")if not N then return end local c=N:FindFirstChild("\082\105\103\104\116\071\114\105\112")if not c or c.Part0~=Handle and c.Part1~=Handle then return end local j=G.Parent if j==Character then return end local W=j:FindFirstChild("\072\117\109\097\110\111\105\100")if not W or W.Health==0 then return end local v=Players:GetPlayerFromCharacter(j)if v and(v==Player or IsTeamMate(Player,v))then return end t=true local K=Damage DealDamage(j,K)local O=tick()wait(.05)t=false end)end function Attack()Damage=DamageValues.SlashDamage Sounds.Slash:Play()local G=Humanoid.RigType==Enum.HumanoidRigType.R6 and{Animations.R6LeftSlash,Animations.R6RightSlash;Animations.R6SideSwipe}or Humanoid.RigType==Enum.HumanoidRigType.R15 and{Animations.R15LeftSlash;Animations.R15SideSwipe}local N=G[math.random(1,#G)]Spawn(function()InvokeClient("\080\108\097\121\065\110\105\109\097\116\105\111\110",N)end)wait(N.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 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 Humanoid.WalkSpeed=17 Sounds.Unsheath:Play()ToolEquipped=true end function Unequipped()if CheckIfAlive()then Humanoid.WalkSpeed=16 end ToolEquipped=false end function OnServerInvoke(G,N,t)if G~=Player or not ToolEquipped or not t or not CheckIfAlive()then return end end function InvokeClient(G,N)local t=nil pcall(function()t=ClientControl:InvokeClient(Player,G,N)end)return t 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 = 10,
	SlashDamage = 20,
}

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

Rate = (1 / 60)

AnimationsBin = Tool:WaitForChild("Animations")
R6Anims = AnimationsBin:WaitForChild("R6")
R15Anims = AnimationsBin:WaitForChild("R15")

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

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

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 CheckTableForInstance(Table, Instance)
	for i, v in pairs(Table) do
		if v == Instance then
			return true
		end
	end
	return false
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") or character:FindFirstChild("Torso")
	if not humanoid or humanoid.Health == 0 or not rootpart then
		return
	end
	UntagHumanoid(humanoid)
	TagHumanoid(humanoid, Player)
	humanoid:TakeDamage(damage)
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")
		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
		HitDelay = true
		local TotalDamage = Damage
		DealDamage(character, TotalDamage)
		local Now = tick()
		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.R6LeftSlash, Animations.R6RightSlash, Animations.R6SideSwipe }
		)
		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

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

function Unequipped()
	if CheckIfAlive() then
		Humanoid.WalkSpeed = 16
	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

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

Blow(Handle)
