function Stand(G)local l=Torso["\076\101\102\116 \072\105\112"]local E=Torso["\082\105\103\104\116 \072\105\112"]local Y=HRP.RootJoint Stance=0 if S.StanceAnimation and not G then spawn(function()local G=Humanoid.CameraOffset local l=Y.C0.p for E=0,90,1.5/S.StanceChangeSpeed do if Stance~=0 then break end local B=Sine(E)Humanoid.CameraOffset=G:lerp(StanceOffset[1],B)Y.C0=CF(l:lerp(VEC3(),B))*CFANG(RAD(-90),0,RAD(180))RS:wait()end end)TweenJoint(ABWeld,CF(),CF(),Sine,S.StanceChangeSpeed)TweenJoint(l,CF(-1,-1,0)*CFANG(0,RAD(-90),0),CF(-0.5,1,0)*CFANG(0,RAD(-90),0),Sine,S.StanceChangeSpeed)TweenJoint(E,CF(1,-1,0)*CFANG(RAD(-180),RAD(90),0),CF(.5,1,0)*CFANG(RAD(-180),RAD(90),0),Sine,S.StanceChangeSpeed)elseif G then Humanoid.CameraOffset=StanceOffset[1]ABWeld.C0=CF()ABWeld.C1=CF()l.C0=CF(-1,-1,0)*CFANG(0,RAD(-90),0)l.C1=CF(-0.5,1,0)*CFANG(0,RAD(-90),0)E.C0=CF(1,-1,0)*CFANG(RAD(-180),RAD(90),0)E.C1=CF(.5,1,0)*CFANG(RAD(-180),RAD(90),0)Y.C0=CFANG(RAD(-90),0,RAD(180))end end function Crouch()local G=Torso["\076\101\102\116 \072\105\112"]local l=Torso["\082\105\103\104\116 \072\105\112"]local E=HRP.RootJoint Stance=1 if S.StanceAnimation then spawn(function()local G=Humanoid.CameraOffset local l=E.C0.p for Y=0,90,1.5/S.StanceChangeSpeed do if Stance~=1 then break end local B=Sine(Y)Humanoid.CameraOffset=G:lerp(StanceOffset[2],B)E.C0=CF(l:lerp(VEC3(0,-1,0),B))*CFANG(RAD(-100),0,RAD(190))RS:wait()end end)TweenJoint(ABWeld,CF(0,0,-0.02),CF(),Sine,S.StanceChangeSpeed)TweenJoint(G,CF(-1,-0.5,0)*CFANG(0,RAD(-60),0),CF(-0.5,.5,1)*CFANG(0,RAD(-90),RAD(-90)),Sine,S.StanceChangeSpeed)TweenJoint(l,CF(1,-0.7,0)*CFANG(RAD(-160),RAD(90),0),CF(.5,.5,1)*CFANG(RAD(-180),RAD(90),0),Sine,S.StanceChangeSpeed)else Humanoid.CameraOffset=StanceOffset[2]ABWeld.C0=CF(0,0,-0.0625)ABWeld.C1=CF()G.C0=CF(-1,-0.5,0)*CFANG(0,RAD(-90),0)G.C1=CF(-0.5,.5,1)*CFANG(0,RAD(-90),RAD(-90))l.C0=CF(1,-0.5,.25)*CFANG(RAD(-180),RAD(90),0)l.C1=CF(.5,.5,1)*CFANG(RAD(-180),RAD(90),0)E.C0=CF(0,-1,0)*CFANG(RAD(-90),0,RAD(180))end end function Prone()local G=Torso["\076\101\102\116 \072\105\112"]local l=Torso["\082\105\103\104\116 \072\105\112"]local E=HRP.RootJoint Stance=2 if S.StanceAnimation then spawn(function()local G=Humanoid.CameraOffset local l=E.C0.p for Y=0,90,1.5/S.StanceChangeSpeed do if Stance~=2 then break end local B=Sine(Y)Humanoid.CameraOffset=G:lerp(StanceOffset[3],B)E.C0=CF(l:lerp(VEC3(0,-2.5,1),B))*CFANG(RAD(180),0,RAD(180))RS:wait()end end)TweenJoint(ABWeld,CF(0,0,-0.125),CF(),Sine,S.StanceChangeSpeed)TweenJoint(G,CF(-1,-1,0)*CFANG(0,RAD(-90),0),CF(-0.5,1,0)*CFANG(0,RAD(-90),0),Sine,S.StanceChangeSpeed)TweenJoint(l,CF(1,-1,0)*CFANG(RAD(-180),RAD(90),0),CF(.5,1,0)*CFANG(RAD(-180),RAD(90),0),Sine,S.StanceChangeSpeed)else Humanoid.CameraOffset=StanceOffset[3]ABWeld.C0=CF(0,0,-0.125)ABWeld.C1=CF()G.C0=CF(-1,-1,0)*CFANG(0,RAD(-90),0)G.C1=CF(-0.5,1,0)*CFANG(0,RAD(-90),0)l.C0=CF(1,-1,0)*CFANG(RAD(-180),RAD(90),0)l.C1=CF(.5,1,0)*CFANG(RAD(-180),RAD(90),0)E.C0=CF(0,-2.5,1)*CFANG(RAD(180),0,RAD(180))end end function Dive(G)local l=(((HRP.CFrame*CFANG(RAD(18),0,0)).lookVector*G)*2.1875)*4000.0 HRP.Velocity=VEC3()Torso.Velocity=VEC3()local E=Instance.new("\066\111\100\121\070\111\114\099\101")E.force=l E.Parent=HRP delay(.05,function()Prone()local G=tick()while true do wait()if tick()-G>.1 then break end E.force=-HRP.Velocity*700 end E:Destroy()end)end
--------------------[ STANCE FUNCTIONS ]----------------------------------------------

function Stand(OnDeselected)
	local LHip = Torso["Left Hip"]
	local RHip = Torso["Right Hip"]
	local Root = HRP.RootJoint
	Stance = 0
	if S.StanceAnimation and not OnDeselected then
		spawn(function()
			local PreviousOffset = Humanoid.CameraOffset
			local PreviousRootP = Root.C0.p
			for X = 0, 90, 1.5 / S.StanceChangeSpeed do
				if Stance ~= 0 then
					break
				end
				local Alpha = Sine(X)
				Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[1], Alpha)
				Root.C0 = CF(PreviousRootP:lerp(VEC3(), Alpha)) * CFANG(RAD(-90), 0, RAD(180))
				RS:wait()
			end
		end)
		TweenJoint(ABWeld, CF(), CF(), Sine, S.StanceChangeSpeed)
		TweenJoint(
			LHip,
			CF(-1, -1, 0) * CFANG(0, RAD(-90), 0),
			CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0),
			Sine,
			S.StanceChangeSpeed
		)
		TweenJoint(
			RHip,
			CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0),
			CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0),
			Sine,
			S.StanceChangeSpeed
		)
	elseif OnDeselected then
		Humanoid.CameraOffset = StanceOffset[1]
		ABWeld.C0 = CF()
		ABWeld.C1 = CF()
		LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0)
		LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
		RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0)
		RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
		Root.C0 = CFANG(RAD(-90), 0, RAD(180))
	end
end

function Crouch()
	local LHip = Torso["Left Hip"]
	local RHip = Torso["Right Hip"]
	local Root = HRP.RootJoint
	Stance = 1
	if S.StanceAnimation then
		spawn(function()
			local PreviousOffset = Humanoid.CameraOffset
			local PreviousRootP = Root.C0.p
			for X = 0, 90, 1.5 / S.StanceChangeSpeed do
				if Stance ~= 1 then
					break
				end
				local Alpha = Sine(X)
				Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[2], Alpha)
				Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -1, 0), Alpha)) * CFANG(RAD(-100), 0, RAD(190))
				RS:wait()
			end
		end)
		TweenJoint(ABWeld, CF(0, 0, -1 / 50), CF(), Sine, S.StanceChangeSpeed)
		TweenJoint(
			LHip,
			CF(-1, -0.5, 0) * CFANG(0, RAD(-60), 0),
			CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90)),
			Sine,
			S.StanceChangeSpeed
		)
		TweenJoint(
			RHip,
			CF(1, -0.7, 0) * CFANG(RAD(-160), RAD(90), 0),
			CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0),
			Sine,
			S.StanceChangeSpeed
		)
	else
		Humanoid.CameraOffset = StanceOffset[2]
		ABWeld.C0 = CF(0, 0, -1 / 16)
		ABWeld.C1 = CF()
		LHip.C0 = CF(-1, -0.5, 0) * CFANG(0, RAD(-90), 0)
		LHip.C1 = CF(-0.5, 0.5, 1) * CFANG(0, RAD(-90), RAD(-90))
		RHip.C0 = CF(1, -0.5, 0.25) * CFANG(RAD(-180), RAD(90), 0)
		RHip.C1 = CF(0.5, 0.5, 1) * CFANG(RAD(-180), RAD(90), 0)
		Root.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, RAD(180))
	end
end

function Prone()
	local LHip = Torso["Left Hip"]
	local RHip = Torso["Right Hip"]
	local Root = HRP.RootJoint
	Stance = 2
	if S.StanceAnimation then
		spawn(function()
			local PreviousOffset = Humanoid.CameraOffset
			local PreviousRootP = Root.C0.p
			for X = 0, 90, 1.5 / S.StanceChangeSpeed do
				if Stance ~= 2 then
					break
				end
				local Alpha = Sine(X)
				Humanoid.CameraOffset = PreviousOffset:lerp(StanceOffset[3], Alpha)
				Root.C0 = CF(PreviousRootP:lerp(VEC3(0, -2.5, 1), Alpha)) * CFANG(RAD(180), 0, RAD(180))
				RS:wait()
			end
		end)
		TweenJoint(ABWeld, CF(0, 0, -1 / 8), CF(), Sine, S.StanceChangeSpeed)
		TweenJoint(
			LHip,
			CF(-1, -1, 0) * CFANG(0, RAD(-90), 0),
			CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0),
			Sine,
			S.StanceChangeSpeed
		)
		TweenJoint(
			RHip,
			CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0),
			CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0),
			Sine,
			S.StanceChangeSpeed
		)
	else
		Humanoid.CameraOffset = StanceOffset[3]
		ABWeld.C0 = CF(0, 0, -1 / 8)
		ABWeld.C1 = CF()
		LHip.C0 = CF(-1, -1, 0) * CFANG(0, RAD(-90), 0)
		LHip.C1 = CF(-0.5, 1, 0) * CFANG(0, RAD(-90), 0)
		RHip.C0 = CF(1, -1, 0) * CFANG(RAD(-180), RAD(90), 0)
		RHip.C1 = CF(0.5, 1, 0) * CFANG(RAD(-180), RAD(90), 0)
		Root.C0 = CF(0, -2.5, 1) * CFANG(RAD(180), 0, RAD(180))
	end
end

function Dive(Speed)
	local DiveVelocity = (HRP.CFrame * CFANG(RAD(18), 0, 0)).lookVector * Speed * (35 / 16) * 4e3
	HRP.Velocity = VEC3()
	Torso.Velocity = VEC3()
	local BF = Instance.new("BodyForce")
	BF.force = DiveVelocity
	BF.Parent = HRP
	delay(0.05, function()
		Prone()
		local Start = tick()
		while true do
			wait()
			if (tick() - Start) > 0.1 then
				break
			end
			BF.force = -HRP.Velocity * 700
		end
		BF:Destroy()
	end)
end
