sp=script.Parent r=game:service("\082\117\110\083\101\114\118\105\099\101")anims={"\082\105\103\104\116\083\108\097\115\104","\076\101\102\116\083\108\097\115\104";"\079\118\101\114\072\101\097\100\083\119\105\110\103"}basedamage=0+script.Parent.AddDam.Value/4 slashdamage=15+script.Parent.AddDam.Value swingdamage=15+script.Parent.AddDam.Value damage=basedamage sword=sp.Handle sp.Taunting.Value=false local V=Instance.new("\083\111\117\110\100")V.SoundId="\114\098\120\097\115\115\101\116\058\047\047\115\111\117\110\100\115\092\115\119\111\114\100\115\108\097\115\104\046\119\097\118"V.Parent=sword V.Volume=.7 local B=Instance.new("\083\111\117\110\100")B.SoundId="\114\098\120\097\115\115\101\116\058\047\047\115\111\117\110\100\115\092\117\110\115\104\101\097\116\104\046\119\097\118"B.Parent=sword B.Volume=0 function blow(V)if V.Parent==nil then return end local B=V.Parent:findFirstChild("\072\117\109\097\110\111\105\100")local I=sp.Parent local b=game.Players:playerFromCharacter(I)local K=I:findFirstChild("\072\117\109\097\110\111\105\100")if B~=nil and(B~=K and K~=nil)then local V=I:FindFirstChild("\082\105\103\104\116 \065\114\109")if V~=nil then local I=V:FindFirstChild("\082\105\103\104\116\071\114\105\112")if I~=nil and(I.Part0==sword or I.Part1==sword)then tagHumanoid(B,b)B:TakeDamage(damage)wait(1)untagHumanoid(B)end end end end function tagHumanoid(V,B)local I=Instance.new("\079\098\106\101\099\116\086\097\108\117\101")I.Value=B I.Name="\099\114\101\097\116\111\114"I.Parent=V end function untagHumanoid(V)if V~=nil then local B=V:findFirstChild("\099\114\101\097\116\111\114")if B~=nil then B.Parent=nil end end end sp.Enabled=true function onActivated()if sp.Enabled and not sp.Taunting.Value then sp.Enabled=false local B=sp.Parent local I=B.Humanoid if I==nil then print("\072\117\109\097\110\111\105\100 \110\111\116 \102\111\117\110\100")return end V:play()newanim=anims[math.random(1,#anims)]while newanim==sp.RunAnim.Value do newanim=anims[math.random(1,#anims)]end sp.RunAnim.Value=newanim if newanim=="\079\118\101\114\072\101\097\100\083\119\105\110\103"then damage=swingdamage else damage=slashdamage end wait(1)damage=basedamage sp.Enabled=true end end function onEquipped()B:play()end sp.Activated:connect(onActivated)sp.Equipped:connect(onEquipped)connection=sword.Touched:connect(blow)



sp=script.Parent

r=game:service("RunService")


anims={"RightSlash","LeftSlash","OverHeadSwing"}

basedamage=0 + (script.Parent.AddDam.Value/4)
slashdamage=15 + script.Parent.AddDam.Value
swingdamage=15 + script.Parent.AddDam.Value
damage=basedamage

sword=sp.Handle
sp.Taunting.Value=false

local SlashSound=Instance.new("Sound")
SlashSound.SoundId="rbxasset://sounds\\swordslash.wav"
SlashSound.Parent=sword
SlashSound.Volume=.7

local UnsheathSound=Instance.new("Sound")
UnsheathSound.SoundId="rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent=sword
UnsheathSound.Volume=0


function blow(hit)
	if (hit.Parent==nil) then return end -- happens when bullet hits sword
	local humanoid=hit.Parent:findFirstChild("Humanoid")
	local vCharacter=sp.Parent
	local vPlayer=game.Players:playerFromCharacter(vCharacter)
	local hum=vCharacter:findFirstChild("Humanoid") -- non-nil if sp 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

sp.Enabled=true
function onActivated()
	if sp.Enabled and not sp.Taunting.Value then
		sp.Enabled=false
		local character=sp.Parent;
		local humanoid=character.Humanoid
		if humanoid==nil then
			print("Humanoid not found")
			return 
		end
		SlashSound:play()
		newanim=anims[math.random(1,#anims)]
		while newanim==sp.RunAnim.Value do
			newanim=anims[math.random(1,#anims)]
		end
		sp.RunAnim.Value=newanim
		if newanim=="OverHeadSwing" then
			damage=swingdamage
		else
			damage=slashdamage
		end
		wait(1)
		damage=basedamage
		sp.Enabled=true
	end
end

function onEquipped()
	UnsheathSound:play()
end

sp.Activated:connect(onActivated)
sp.Equipped:connect(onEquipped)

connection=sword.Touched:connect(blow)


