function blow(K)local k=K.Parent:findFirstChild("\072\117\109\097\110\111\105\100")local W=Tool.Parent local A=game.Players:playerFromCharacter(W)local d=W:findFirstChild("\072\117\109\097\110\111\105\100")if k~=nil and(k~=d and d~=nil)then local K=W:FindFirstChild("\082\105\103\104\116 \065\114\109")if K~=nil then local W=K:FindFirstChild("\082\105\103\104\116\071\114\105\112")if W~=nil and(W.Part0==sword or W.Part1==sword)then tagHumanoid(k,A)k:TakeDamage(damage)wait(1)untagHumanoid(k)end end end end function tagHumanoid(K,k)local W=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")W.Value=k W.Name="\099\114\101\097\116\111\114"W.Parent=K end function untagHumanoid(K)if K~=nil then local k=K:findFirstChild("\099\114\101\097\116\111\114")if k~=nil then k.Parent=nil end end end function attack()local K=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")K.Name="\116\111\111\108\097\110\105\109"K.Value="\083\108\097\115\104"K.Parent=Tool end local K=false function onActivated()if K then return end K=true damage=slash_damage print("\065")while Tool.Enabled do wait()end attack()while not Tool.Enabled do wait()end damage=nonslash_damage print("\066")K=false end script.Parent.Activated:connect(onActivated)script.Parent.Equipped:connect(onEquipped)connection=sword.Touched:connect(blow)
-- Called when the katana(held by a player) comes in contact with
-- another humanoid object
function blow(hit)
	local humanoid = hit.Parent:findFirstChild("Humanoid")
	local vCharacter = Tool.Parent
	local vPlayer = game.Players:playerFromCharacter(vCharacter)
	local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
	if humanoid ~= nil and humanoid ~= hum and hum ~= nil then
		-- final check, make sure sword is in-hand

		local right_arm = vCharacter:FindFirstChild("Right Arm")
		if right_arm ~= nil then
			local joint = right_arm:FindFirstChild("RightGrip")
			if joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword) then
				tagHumanoid(humanoid, vPlayer)
				humanoid:TakeDamage(damage)
				wait(1)
				untagHumanoid(humanoid)
			end
		end
	end
end

function tagHumanoid(humanoid, player)
	local creator_tag = Instance.new("ObjectValue")
	creator_tag.Value = player
	creator_tag.Name = "creator"
	creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
	if humanoid ~= nil then
		local tag = humanoid:findFirstChild("creator")
		if tag ~= nil then
			tag.Parent = nil
		end
	end
end

function attack()
	--SlashSound:play()
	local anim = Instance.new("StringValue")
	anim.Name = "toolanim"
	anim.Value = "Slash"
	anim.Parent = Tool
end

local debounce = false
function onActivated()
	if debounce then
		return
	end
	debounce = true
	damage = slash_damage
	print("A")
	while Tool.Enabled do
		wait()
	end -- necessary to avoid debouncing conflicts between this script and LocalKatanaScript!
	attack()
	while not Tool.Enabled do
		wait()
	end -- necessary to avoid debouncing conflicts between this script and LocalKatanaScript!
	damage = nonslash_damage
	print("B")
	debounce = false
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

connection = sword.Touched:connect(blow)
