Humanoid.StateChanged:Connect(function(d,R)if isFirstPerson==true and IncludeJumpSway==true then if R==Enum.HumanoidStateType.Landed then local d=Instance.new("\067\070\114\097\109\101\086\097\108\117\101")d.Value=CFrame.new(0,0,0)*CFrame.Angles(math.rad(-0.75)*SwaySize,0,0)local R=TweenService:Create(d,TweenInfo.new(.18/Sensitivity,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{Value=CFrame.new(0,0,0)})R:Play()game.Debris:AddItem(R,2)R.Completed:Connect(function()d.Value=CFrame.new(0,0,0)*CFrame.Angles(math.rad(.225)*SwaySize,0,0)local R=TweenService:Create(d,TweenInfo.new(.72/Sensitivity,Enum.EasingStyle.Sine,Enum.EasingDirection.Out),{Value=CFrame.new(0,0,0)})R:Play()game.Debris:AddItem(R,3)end)spawn(function()for R=1,60,1 do Camera.CFrame=Camera.CFrame*d.Value RunService.Heartbeat:Wait()end end)local v=TweenService:Create(JumpSwayGoal,TweenInfo.new(.15/Sensitivity,Enum.EasingStyle.Sine,Enum.EasingDirection.Out),{Value=CFrame.new(0,0,0)*CFrame.Angles(-math.rad(5)*SwaySize,0,0)})v:Play()game.Debris:AddItem(v,2)v.Completed:Connect(function()local d=TweenService:Create(JumpSwayGoal,TweenInfo.new(.7/Sensitivity,Enum.EasingStyle.Quart,Enum.EasingDirection.Out),{Value=CFrame.new(0,0,0)})d:Play()game.Debris:AddItem(d,2)end)elseif R==Enum.HumanoidStateType.Freefall then local d=TweenService:Create(JumpSwayGoal,TweenInfo.new(.5/Sensitivity,Enum.EasingStyle.Sine),{Value=CFrame.new(0,0,0)*CFrame.Angles(math.rad(7.5)*SwaySize,0,0)})d:Play()game.Debris:AddItem(d,2)end end end)local d
-- listen for jumping and landing and apply Sway and camera mvoement to the Viewmodel
Humanoid.StateChanged:Connect(function(oldstate, newstate)
	if isFirstPerson == true and IncludeJumpSway == true then -- dont apply camera/Viewmodel changes if we aren't in first person
		if newstate == Enum.HumanoidStateType.Landed then
			-- animate the camera's landing "thump"
			--
			-- tween a dummy cframe value for camera recoil
			local camedit = Instance.new("CFrameValue")
			camedit.Value = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-0.75) * SwaySize, 0, 0)
			local landedrecoil = TweenService:Create(
				camedit,
				TweenInfo.new((0.03 * 6) / Sensitivity, Enum.EasingStyle.Linear, Enum.EasingDirection.Out),
				{ Value = CFrame.new(0, 0, 0) }
			)
			landedrecoil:Play()
			game.Debris:AddItem(landedrecoil, 2)
			landedrecoil.Completed:Connect(function()
				camedit.Value = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0.225) * SwaySize, 0, 0)
				local landedrecovery = TweenService:Create(
					camedit,
					TweenInfo.new((0.03 * 24) / Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out),
					{ Value = CFrame.new(0, 0, 0) }
				)
				landedrecovery:Play()
				game.Debris:AddItem(landedrecovery, 3)
			end)
			-- apply the camera adjustments
			spawn(function()
				for i = 1, 60 do
					Camera.CFrame = Camera.CFrame * camedit.Value
					RunService.Heartbeat:Wait()
				end
			end)
			-- animate the jump Sway to make the Viewmodel thump down on landing
			local viewmodelrecoil = TweenService:Create(
				JumpSwayGoal,
				TweenInfo.new(0.15 / Sensitivity, Enum.EasingStyle.Sine, Enum.EasingDirection.Out),
				{ Value = CFrame.new(0, 0, 0) * CFrame.Angles(-math.rad(5) * SwaySize, 0, 0) }
			)
			viewmodelrecoil:Play()
			game.Debris:AddItem(viewmodelrecoil, 2)
			viewmodelrecoil.Completed:Connect(function()
				local viewmodelrecovery = TweenService:Create(
					JumpSwayGoal,
					TweenInfo.new(0.7 / Sensitivity, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
					{ Value = CFrame.new(0, 0, 0) }
				)
				viewmodelrecovery:Play()
				game.Debris:AddItem(viewmodelrecovery, 2)
			end)
		elseif newstate == Enum.HumanoidStateType.Freefall then
			-- animate jump Sway when the Character is falling or jumping
			local viewmodeljump = TweenService:Create(
				JumpSwayGoal,
				TweenInfo.new(0.5 / Sensitivity, Enum.EasingStyle.Sine),
				{ Value = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(7.5) * SwaySize, 0, 0) }
			)
			viewmodeljump:Play()
			game.Debris:AddItem(viewmodeljump, 2)
		end
	end
end)

local ArmCoroutine
