r=game:service("\082\117\110\083\101\114\118\105\099\101")local v=1 local B=5 sword=script.Parent.Handle Tool=script.Parent local Q=sword:WaitForChild("\083\108\097\115\104\083\111\117\110\100")function blow(B)if not B or not B.Parent then return end local Q=B.Parent:findFirstChild("\072\117\109\097\110\111\105\100")local I=Tool.Parent local u=game.Players:playerFromCharacter(I)local U=I:findFirstChild("\072\117\109\097\110\111\105\100")if Q~=nil and(Q.Health>0 and(Q~=U and U~=nil))then local B=I:FindFirstChild("\082\105\103\104\116 \065\114\109")if B~=nil then local I=B:FindFirstChild("\082\105\103\104\116\071\114\105\112")if I~=nil and(I.Part0==sword or I.Part1==sword)then tagHumanoid(Q,u)Q:TakeDamage(v)if Q.Health==0 then for v,B in pairs(Q.Parent:GetChildren())do if B:IsA("\066\097\115\101\080\097\114\116")then for v=1,2,1 do local Q=Instance.new("\080\097\114\116")Q.Name="\087\111\111\100"Q.Locked=true Q.CanCollide=true Q.Anchored=false Q.FormFactor=Enum.FormFactor.Custom Q.TopSurface=Enum.SurfaceType.Smooth Q.BottomSurface=Enum.SurfaceType.Smooth Q.Size=Vector3.new(1,.8,1)Q.Material=Enum.Material.Wood Q.BrickColor=BrickColor.new("\068\097\114\107 \111\114\097\110\103\101");(game:GetService("\068\101\098\114\105\115")):AddItem(Q,5)Q.Parent=game:GetService("\087\111\114\107\115\112\097\099\101")Q.CFrame=B.CFrame+Vector3.new(0,v*Q.Size.y,0)B:Destroy()end end end end end end end end function tagHumanoid(v,B)local Q=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")Q.Value=B Q.Name="\099\114\101\097\116\111\114"Q.Parent=v game.Debris:AddItem(Q,1)end function attack()v=B Q:play()local I=Instance.new("\083\116\114\105\110\103\086\097\108\117\101")I.Name="\116\111\111\108\097\110\105\109"I.Value="\083\108\097\115\104"I.Parent=Tool end function swordUp()Tool.GripForward=Vector3.new(-1,0,0)Tool.GripRight=Vector3.new(0,1,0)Tool.GripUp=Vector3.new(0,0,1)end function swordOut()Tool.GripForward=Vector3.new(0,0,1)Tool.GripRight=Vector3.new(0,-1,0)Tool.GripUp=Vector3.new(-1,0,0)end function swordAcross() end Tool.Enabled=true local I=0 function onActivated()if not Tool.Enabled then return end Tool.Enabled=false local v=Tool.Parent local B=v.Humanoid if B==nil then print("\072\117\109\097\110\111\105\100 \110\111\116 \102\111\117\110\100")return end t=r.Stepped:wait()attack()I=t Tool.Enabled=true end function onEquipped() end script.Parent.Activated:connect(onActivated)script.Parent.Equipped:connect(onEquipped)connection=sword.Touched:connect(blow)


r = game:service("RunService")

local damage = 1

local slash_damage = 5

sword = script.Parent.Handle
Tool = script.Parent

local SlashSound = sword:WaitForChild("SlashSound")

function blow(hit)
	if not hit or not hit.Parent then
		return
	end
	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.Health > 0 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)
				if humanoid.Health == 0 then
					for i, v in pairs(humanoid.Parent:GetChildren()) do
						if v:IsA("BasePart") then
							for ii = 1, 2 do
								local Wood = Instance.new("Part")
								Wood.Name = "Wood"
								Wood.Locked = true
								Wood.CanCollide = true
								Wood.Anchored = false
								Wood.FormFactor = Enum.FormFactor.Custom
								Wood.TopSurface = Enum.SurfaceType.Smooth
								Wood.BottomSurface = Enum.SurfaceType.Smooth
								Wood.Size = Vector3.new(1, 0.8, 1)
								Wood.Material = Enum.Material.Wood
								Wood.BrickColor = BrickColor.new("Dark orange")
								game:GetService("Debris"):AddItem(Wood, 5)
								Wood.Parent = game:GetService("Workspace")
								Wood.CFrame = v.CFrame + Vector3.new(0, (ii * Wood.Size.y), 0)
								v:Destroy()
							end

						end
					end
				end
			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

	game.Debris:AddItem(creator_tag, 1)

end


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

function swordUp()
	Tool.GripForward = Vector3.new(-1,0,0)
	Tool.GripRight = Vector3.new(0,1,0)
	Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
	Tool.GripForward = Vector3.new(0,0,1)
	Tool.GripRight = Vector3.new(0,-1,0)
	Tool.GripUp = Vector3.new(-1,0,0)
end

function swordAcross()
	-- parry
end


Tool.Enabled = true
local last_attack = 0
function onActivated()

	if not Tool.Enabled then
		return
	end

	Tool.Enabled = false

	local character = Tool.Parent;
	local humanoid = character.Humanoid
	if humanoid == nil then
		print("Humanoid not found")
		return 
	end

	t = r.Stepped:wait()

	attack()

	last_attack = t

	--wait(.5)

	Tool.Enabled = true
end

function onEquipped()
end

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

connection = sword.Touched:connect(blow)
