local function v(v,B)while not v:FindFirstChild(B)do v.ChildAdded:wait()end return v[B]end local B=script.Parent local Q={}local I local u local function U(v)if Q[v]then Q[v]:Play()end end local function L(v)if Q[v]then Q[v]:Stop()end end function OnEquipped(L)u=B.Parent I=v(u,"\072\117\109\097\110\111\105\100")if I then Q.EquipAnim=I:LoadAnimation(v(B,"\069\113\117\105\112\065\110\105\109\053"))Q.IdleAnim=I:LoadAnimation(v(B,"\073\100\108\101\065\110\105\109\051"))Q.OverheadAnim=I:LoadAnimation(v(B,"\079\118\101\114\104\101\097\100\065\110\105\109\050"))Q.SlashAnim=I:LoadAnimation(v(B,"\083\108\097\115\104\065\110\105\109\050"))Q.ThrustAnim=I:LoadAnimation(v(B,"\084\104\114\117\115\116\065\110\105\109\050"))Q.UnequipAnim=I:LoadAnimation(v(B,"\085\110\101\113\117\105\112\065\110\105\109\050"))end L.KeyDown:connect(function(v)function Taunt()local v={}for Q,I in pairs(game.Players:GetChildren())do if I~=game.Players:GetPlayerFromCharacter(B.Parent)then if I.Character and I.Character:FindFirstChild("\084\111\114\115\111")then v[#v+1]=I.Character.Torso end end end local Q=B.Parent.Torso.Position for v,B in pairs(v)do if(Q-B.Position).magnitude<40 then local v=(Q-B.Position).unit local I=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")I.velocity=Vector3.new(0,1,0)I.Parent=B B.Velocity=v*250 game.Debris:AddItem(I,.5)end end end function rTaunt()local v={}for Q,I in pairs(game.Players:GetChildren())do if I~=game.Players:GetPlayerFromCharacter(B.Parent)then if I.Character and I.Character:FindFirstChild("\084\111\114\115\111")then v[#v+1]=I.Character.Torso end end end local Q=B.Parent.Torso.Position for v,B in pairs(v)do if(Q-B.Position).magnitude<40 then local v=(Q-B.Position).unit local I=Instance.new("\066\111\100\121\086\101\108\111\099\105\116\121")I.velocity=Vector3.new(0,1,0)I.Parent=B B.Velocity=-v*250 game.Debris:AddItem(I,.5)end end end if v=="\113"then if debounce==nil then debounce=true Q.EquipAnim:Play(.1,.8,2)Taunt()wait(5)debounce=nil end elseif v=="\101"then if debounce2==nil then debounce2=true Q.EquipAnim:Play(.1,.8,2)rTaunt()wait(5)debounce2=nil end end end)Q.EquipAnim:Play(.1,.8,1)U("\073\100\108\101\065\110\105\109")end function OnUnequipped()B.Handle.deactivate:Play()for v,B in pairs(Q)do L(v)end end B.Equipped:connect(OnEquipped)B.Unequipped:connect(OnUnequipped);(v(B,"\080\108\097\121\083\108\097\115\104")).Changed:connect(function(v)U("\083\108\097\115\104\065\110\105\109")end);(v(B,"\080\108\097\121\084\104\114\117\115\116")).Changed:connect(function(v)U("\084\104\114\117\115\116\065\110\105\109")end);(v(B,"\080\108\097\121\079\118\101\114\104\101\097\100")).Changed:connect(function(v)Q.OverheadAnim:Play()end)

local function WaitForChild(parent, childName)
	while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
	return parent[childName]
end

local Tool = script.Parent

local Animations = {}
local MyHumanoid
local MyCharacter


local function PlayAnimation(animationName)
	if Animations[animationName] then
		Animations[animationName]:Play()
	end
end

local function StopAnimation(animationName)
	if Animations[animationName] then
		Animations[animationName]:Stop()
	end
end


function OnEquipped(mouse)
	MyCharacter = Tool.Parent
	MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
	if MyHumanoid then
		Animations['EquipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'EquipAnim5'))
		Animations['IdleAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
		Animations['OverheadAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'OverheadAnim2'))
		Animations['SlashAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'SlashAnim2'))
		Animations['ThrustAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrustAnim2'))
		Animations['UnequipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'UnequipAnim2'))
	end
mouse.KeyDown:connect(function(key)
function Taunt()
	--gather all of the humanoids in a 30stud radius
	local torsos = {}
	for _, p in pairs(game.Players:GetChildren()) do
		if p ~= game.Players:GetPlayerFromCharacter(Tool.Parent) then
			if p.Character and p.Character:FindFirstChild('Torso') then
				torsos[#torsos+1] = p.Character.Torso
			end
		end
	end

	--now pull them in towards us
	local mpos = Tool.Parent.Torso.Position
	for _, torso in pairs(torsos) do
		if (mpos-torso.Position).magnitude < 40 then
			local dir = (mpos-torso.Position).unit
			------------ stolen from dagger of time to make a character "fly" in some direction
				local force = Instance.new("BodyVelocity")
				force.velocity = Vector3.new(0,1,0)
				force.Parent = torso
				torso.Velocity = dir*250
				game.Debris:AddItem(force, 0.5)
			------------
		end
	end
end

function rTaunt()
	--gather all of the humanoids in a 30stud radius
	local torsos = {}
	for _, p in pairs(game.Players:GetChildren()) do
		if p ~= game.Players:GetPlayerFromCharacter(Tool.Parent) then
			if p.Character and p.Character:FindFirstChild('Torso') then
				torsos[#torsos+1] = p.Character.Torso
			end
		end
	end

	--now pull them in towards us
	local mpos = Tool.Parent.Torso.Position
	for _, torso in pairs(torsos) do
		if (mpos-torso.Position).magnitude < 40 then
			local dir = (mpos-torso.Position).unit
			------------ stolen from dagger of time to make a character "fly" in some direction
				local force = Instance.new("BodyVelocity")
				force.velocity = Vector3.new(0,1,0)
				force.Parent = torso
				torso.Velocity = -dir*250
				game.Debris:AddItem(force, 0.5)
			------------
		end
	end
end

	if key == 'q' then
		if debounce==nil then
			debounce=true
	Animations['EquipAnim']:Play(.1,.8,2)
			Taunt()
			wait(5)
			debounce=nil
		end
	elseif key == 'e' then
		if debounce2==nil then
			debounce2=true
	Animations['EquipAnim']:Play(.1,.8,2)
			rTaunt()
			wait(5)
			debounce2=nil
		end
	end
end)


	Animations['EquipAnim']:Play(.1,.8,1)
	PlayAnimation('IdleAnim')
end

function OnUnequipped()
	Tool.Handle.deactivate:Play()
	for animName, _ in pairs(Animations) do
		StopAnimation(animName)
	end
end

Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)

WaitForChild(Tool, 'PlaySlash').Changed:connect(
	function (value)
		--if value then
			PlayAnimation('SlashAnim')
		--else
		--	StopAnimation('SlashAnim')
		--end
	end)

WaitForChild(Tool, 'PlayThrust').Changed:connect(
	function (value)
		--if value then
			PlayAnimation('ThrustAnim')
		--else
		--	StopAnimation('ThrustAnim')
		--end
	end)

WaitForChild(Tool, 'PlayOverhead').Changed:connect(
	function (value)
		--if value then
			Animations['OverheadAnim']:Play()
		--else
		--	StopAnimation('OverheadAnim')
		--end
	end)
