Play sound when sprinting is low

I want to play a sound when a player’s sprint is no more and fade out when the sprinting bar fills back up. I don’t know where to put it in this script nor how to type it. the sound is inside the local script by the way.

Sprinting Script:

local SPRINT_SPEED = 18 -- Your WalkSpeed when sprinting.
local DEFAULT_SPEED = 8 -- Normal speed.
local MAXIMUM_STAMINA = 100

local STAMINA_DECREASE = 0.4
local SPRINT_KEY = Enum.KeyCode.LeftShift

local UserInputService = game:GetService("UserInputService")

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Exterior = script.Parent.Exterior
local Bar = Exterior.Bar

local Sprinting = false
local StaminaAmount = MAXIMUM_STAMINA -- StaminaAmount/MAXIMUM_STAMINA

UserInputService.InputBegan:Connect(function(Key, Processed)
	if not Processed then
		if Key.KeyCode == SPRINT_KEY then
			-- Player is sprinting.

			Sprinting = true
		end
	end
end)

UserInputService.InputEnded:Connect(function(Key, Processed)
	if not Processed then
		if Key.KeyCode == SPRINT_KEY then
			-- Player stopped sprinting.

			Sprinting = false
		end
	end
end)

game["Run Service"].RenderStepped:Connect(function()
	if StaminaAmount > 0 then -- You have more than 0 stamina in your tank.
		if Sprinting then -- If you're actually holding down the key.
			if Humanoid.MoveDirection.Magnitude > 0 then
				Humanoid.WalkSpeed = SPRINT_SPEED
				StaminaAmount -= STAMINA_DECREASE
			end
		else
			Humanoid.WalkSpeed = DEFAULT_SPEED
		end
	else
		Humanoid.WalkSpeed = DEFAULT_SPEED
	end

	if StaminaAmount < MAXIMUM_STAMINA then
		-- do someting.
		Exterior.Visible = true

		local Formula = (StaminaAmount/MAXIMUM_STAMINA)
		Bar:TweenSizeAndPosition(UDim2.new(1, 0, Formula, 0), UDim2.new(0, 0, 1-Formula, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1, true)

		if not Sprinting then
			StaminaAmount += STAMINA_DECREASE
		end
	else
		-- Hide if full.

		Exterior.Visible = false
	end
end)

What you need to do is have a value that keeps the volume of the playing sound.

such as SoundVolume = 0

When the sprint ends, Sprinting = false
set the SoundVolume to 1

each render step check
if SoundVolume > 0 then SoundVolume = SoundVolume - ()

if they start running again (Sprinting = true) then you can just set the volume to 0 again

Are you able to tell me where should I type it and how?

Edit: Nevermind, I got confused on what you said. I think I understand now. Although, can you explain what you mean by this:

Edit 2: I figured how to type it in but your steps didn’t work out, nothing played.