sp=script.Parent function waitfor(g,F)while g:FindFirstChild(F)==nil do g.ChildAdded:wait()end return g:FindFirstChild(F)end reloading=waitfor(sp,"\082\101\108\111\097\100\105\110\103")down=waitfor(sp,"\077\111\117\115\101\068\111\119\110")runanim=waitfor(sp,"\082\117\110\065\110\105\109")animspeed=1.2 equipspeed=1.5 originalgrip=CFrame.new(0,0,-1.1,0,0,1,1,0,0,0,1,0)currentgrip=originalgrip function swordUp()currentgrip=originalgrip sp.Grip=currentgrip end function swordOut()currentgrip=originalgrip*CFrame.Angles(math.pi/4,.4,0)sp.Grip=currentgrip end function spinsword(g)delay(0,function()local F=tick()local b=F+g while tick()<b do sp.Grip=currentgrip*CFrame.Angles((math.pi*2)*((tick()-F)/g),0,0)wait()end sp.Grip=currentgrip end)end function update(g)if g~=nil then if reloading.Value then g.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\087\097\105\116\067\117\114\115\111\114\046\112\110\103"else g.Icon="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\092\071\117\110\067\117\114\115\111\114\046\112\110\103"end end end runanim.Changed:connect(function()local g=sp.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")local F=sp.Parent:FindFirstChild("\084\111\114\115\111")local b=sp:FindFirstChild(runanim.Value)if b and(F and g)then local F=g:LoadAnimation(b)if F and g.Health>0 then F:Play(nil,nil,animspeed)end end end)function Equipped(g)if g~=nil then update(g)reloading.Changed:connect(function()update(g)end)g.Button1Down:connect(function()down.Value=true end)g.Button1Up:connect(function()down.Value=false end)local F=sp.Parent:FindFirstChild("\072\117\109\097\110\111\105\100")local b=sp.Parent:FindFirstChild("\084\111\114\115\111")if b and F then local g=sp:FindFirstChild("\069\113\117\105\112")if g~=nil then local b=F:LoadAnimation(g)if b and F.Health>0 then b:Play(nil,nil,equipspeed)end end local b=sp:FindFirstChild("\072\111\108\100")if b~=nil then if HoldAnim then HoldAnim:Stop()end HoldAnim=F:LoadAnimation(b)if HoldAnim and F.Health>0 then HoldAnim:Play()end end end end end function Unequipped()down.Value=false if HoldAnim then HoldAnim:Stop()end end sp.Equipped:connect(Equipped)sp.Unequipped:connect(Unequipped)
--Made by Stickmasterluke

sp = script.Parent

function waitfor(a, b)
	while a:FindFirstChild(b) == nil do
		a.ChildAdded:wait()
	end
	return a:FindFirstChild(b)
end

reloading = waitfor(sp, "Reloading")
down = waitfor(sp, "MouseDown")
runanim = waitfor(sp, "RunAnim")

animspeed = 1.2 --lower number is slower
equipspeed = 1.5
originalgrip = CFrame.new(0, 0, -1.1, 0, 0, 1, 1, 0, 0, 0, 1, 0)
currentgrip = originalgrip
function swordUp()
	currentgrip = originalgrip
	sp.Grip = currentgrip
end
function swordOut()
	currentgrip = originalgrip * CFrame.Angles(math.pi / 4, 0.4, 0)
	sp.Grip = currentgrip
end
function spinsword(spintime)
	delay(0, function()
		local startspin = tick()
		local endspin = startspin + spintime
		while tick() < endspin do
			sp.Grip = currentgrip * CFrame.Angles(math.pi * 2 * ((tick() - startspin) / spintime), 0, 0)
			wait()
		end
		sp.Grip = currentgrip
	end)
end

function update(mouse)
	if mouse ~= nil then
		if reloading.Value then
			mouse.Icon = "rbxasset://textures\\GunWaitCursor.png"
		else
			mouse.Icon = "rbxasset://textures\\GunCursor.png"
		end
	end
end

runanim.Changed:connect(function()
	local h = sp.Parent:FindFirstChild("Humanoid")
	local t = sp.Parent:FindFirstChild("Torso")
	local anim = sp:FindFirstChild(runanim.Value)
	if anim and t and h then
		local theanim = h:LoadAnimation(anim)
		if theanim and h.Health > 0 then
			theanim:Play(nil, nil, animspeed)
		end
	end
end)

function Equipped(mouse)
	if mouse ~= nil then
		update(mouse)
		reloading.Changed:connect(function()
			update(mouse)
		end)
		mouse.Button1Down:connect(function()
			down.Value = true
		end)
		mouse.Button1Up:connect(function()
			down.Value = false
		end)
		local h = sp.Parent:FindFirstChild("Humanoid")
		local t = sp.Parent:FindFirstChild("Torso")
		if t and h then
			local equipanim = sp:FindFirstChild("Equip")
			if equipanim ~= nil then
				local EquipAnim = h:LoadAnimation(equipanim)
				if EquipAnim and h.Health > 0 then
					EquipAnim:Play(nil, nil, equipspeed)
				end
			end
			local holdanim = sp:FindFirstChild("Hold")
			if holdanim ~= nil then
				if HoldAnim then
					HoldAnim:Stop()
				end
				HoldAnim = h:LoadAnimation(holdanim)
				if HoldAnim and h.Health > 0 then
					HoldAnim:Play()
				end
			end
		end
	end
end

function Unequipped()
	down.Value = false
	if HoldAnim then
		HoldAnim:Stop()
	end
end

sp.Equipped:connect(Equipped)
sp.Unequipped:connect(Unequipped)
